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

Created on 2 May 2017  ·  16Comments  ·  Source: ryanoasis/vim-devicons

Required Info

  • [x] I have searched the issues for my issue and found nothing related and/or helpful
  • [x] I have read or at least glanced at the FAQ
  • [x] I have read or at least glanced at the Wiki

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

  • [x] What version of vim-devicons are you using? 0.9.0
  • [x] Are you using vim from the terminal or a GUI vim? Terminal
  • [x] 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.

⚠ confirmed bug

All 16 comments

@x4121 Hey thanks for the report! :smile: Good catch.

So right now this plugin tacks that part on (and it's not even configurable :cry:): 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 :blush:

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

Thanks for the plugin btw :+1:

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 :laughing:

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. :slightly_smiling_face:

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).

@x4121 Thanks.. what timing.. I am actually working on this _right now_ :smile:

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

But nice to hear that :slightly_smiling_face:

@x4121 Oh yeah no worries :smile:

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? :blush:

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

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.

@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]'

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

Already checked, works like a charm :slightly_smiling_face:

Great! Thanks for verifying. Also thanks for the report. :heart:

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 :stuck_out_tongue: but let me know if otherwise :blush:

Thanks for fixing it that fast :smiley:

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 :wink:

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

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

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

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 :stuck_out_tongue_winking_eye:)
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).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wuqiong4945 picture wuqiong4945  ·  7Comments

slabua picture slabua  ·  6Comments

soulomoon picture soulomoon  ·  10Comments

Leeiio picture Leeiio  ·  10Comments

ntropia2 picture ntropia2  ·  4Comments