Skip to content

vim-devicons breaks vim-airlines ffenc#skip_expected_string (hide file format/encoding) #203

Closed

Description

@x4121

Required Info

  • I have searched the issues for my issue and found nothing related and/or helpful

  • I have read or at least glanced at the FAQ

  • I have read or at least glanced at the Wiki

  • What version of vim are you using? Vi IMproved 8.0 (2016 Sep 12, compiled Mar 17 2017 12:13:35)

  • What version of vim-devicons are you using? 0.9.0

  • Are you using vim from the terminal or a GUI vim? Terminal

  • Are you using Mac, Linux or Windows? Linux

Bug

vim-airline has the feature to hide the expected file format and encoding (g:airline#parts#ffenc#skip_expected_string). This is very useful, since I'm only really interesting in the file format/encoding if it's NOT utf-8+unix. Using vim-devicons "breaks" this feature (the function checking the value is not called anymore or its return value is ignored?).

Would be nice to a) check the value of g:airline#parts#ffenc#skip_expected_string or b) implement something equivalent in vim-devicons.

Activity

  1. ryanoasis commented on May 2, 2017

    @ryanoasis
    Owner

    @x4121 Hey thanks for the report! 😄 Good catch.

    So right now this plugin tacks that part on (and it's not even configurable 😢): https://github.com/ryanoasis/vim-devicons/blob/master/autoload/airline/extensions/tabline/formatters/webdevicons.vim#L9

    Should be an easy fix.

    In the meantime you can hack that line to remove it or disable VimDevIcons plugin altogether 😊

  2. added this to the v0.9.1 milestone on May 2, 2017
  3. self-assigned this
    on May 2, 2017
  4. x4121 commented on May 3, 2017

    @x4121
    Author

    Why write it configurable if you don't know of the feature in the first place 🙂

    Thanks for the plugin btw 👍

  5. ryanoasis commented on May 6, 2017

    @ryanoasis
    Owner

    Thanks for the kind words.

    Why write it configurable if you don't know of the feature in the first place

    Yeah that's a good point. I guess I feel like there should have been foresight but maybe that's wishful thinking 😆

  6. x4121 commented on May 6, 2017

    @x4121
    Author

    Changing https://github.com/ryanoasis/vim-devicons/blob/master/plugin/webdevicons.vim#L685 from if g:webdevicons_enable_airline_statusline_fileformat_symbols to if g:webdevicons_enable_airline_statusline_fileformat_symbols && airline#parts#ffenc() != '' would fix it for me. 🙂

    Don't use a tabline, maybe changes in the file you linked are necessary as well (also I never wrote vimscript, there are probably nicer ways to do this).

  7. ryanoasis commented on May 7, 2017

    @ryanoasis
    Owner

    @x4121 Thanks.. what timing.. I am actually working on this right now 😄

  8. x4121 commented on May 7, 2017

    @x4121
    Author

    Haha.. sorry, didn't want to disturb/nag you there 😂

    But nice to hear that 🙂

  9. ryanoasis commented on May 7, 2017

    @ryanoasis
    Owner

    @x4121 Oh yeah no worries 😄

    Honestly I completely forgot about the g:webdevicons_enable_airline_statusline_fileformat_symbols option!

    Does disabling it not do what you expect:

    let g:webdevicons_enable_airline_statusline_fileformat_symbols = 0

    You are wanting to not show any encoding right?

    Doesn't setting this accomplish that:

    let g:airline#parts#ffenc#skip_expected_string='utf-8[unix]'
    let g:webdevicons_enable_airline_statusline_fileformat_symbols = 0

    Or am I missing something? 😊

  10. ryanoasis commented on May 7, 2017

    @ryanoasis
    Owner

    Nevertheless your suggested change is a good defensive check and doesn't break anything. I will add it soon

  11. x4121 commented on May 7, 2017

    @x4121
    Author

    Does disabling it not do what you expect:

    That would disable the replacement text to icon. I do really like the icons, but I only need the information for file format and encoding if it's not what I am expecting. To see "utf-8[unix]" (or "utf-8 ") for all my files is unnecessary information (like git status would show me all files that have not changed). But I wouldn't mind "utf-8 " or "latin-1 ", since that might indicate an error.

  12. ryanoasis commented on May 7, 2017

    @ryanoasis
    Owner

    @x4121 Ah okay I understand now.

    So with your suggested change and not disabling the glyphs for fileencoding it does seem to be working as expected.

    I have been testing with setting fileenconding via command mode and it does work but doesn't update until AirlineRefresh is called. This shouldn't be a big issue as most likely you aren't going to be switching back and forth filetypes?

    :set fileenconding=utf-8
    :AirlineRefresh
    :set fileencoding=latin-1
    :AirlineRefresh

    vimrc settings:

    let g:airline#parts#ffenc#skip_expected_string='utf-8[unix]'
  13. ryanoasis commented on May 7, 2017

    @ryanoasis
    Owner

    I am going to release this in a few hours 📦 , if you would like to help test the 0.9.1 branch is up. Thanks

  14. x4121 commented on May 7, 2017

    @x4121
    Author

    Already checked, works like a charm 🙂

  15. ryanoasis commented on May 7, 2017

    @ryanoasis
    Owner

    Great! Thanks for verifying. Also thanks for the report. ❤️

    By the way, I usually ask if someone makes an unofficial code fix if they would like to submit a PR but I just assumed you didn't want/care to do that 😛 but let me know if otherwise 😊

  16. x4121 commented on May 7, 2017

    @x4121
    Author

    Thanks for fixing it that fast 😃

    After reporting I was thinking about writing one... but I can barely read vimscript and feared I couldn't comply with the boy scout rule 😉

  17. ryanoasis commented on May 7, 2017

    @ryanoasis
    Owner

    @x4121 Sure no problem. I wish some of the other issues were as fast 😊

    Interesting link I honestly haven't read that before, so thanks for that too.

  18. x4121 commented on May 7, 2017

    @x4121
    Author

    @ryanoasis yeah, I know the joy of stumbling upon an easy/fast to fix problem 😉

    It's a nice book, being in small and easy to grok chunks makes it far more attractive to read than a lot of other tech literature (also you can sound a lot smarter by inserting those ideas now and then 😜)
    And I guess most people would agree with this rule. If you have to touch the code, at least don't make it worse (and not knowing a language makes it quite hard to even know if you make it better/worse).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions