Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
7 tasks done
x4121 opened this issue May 2, 2017 · 16 comments
Closed
7 tasks done
Assignees
Milestone

Comments

@x4121
Copy link

x4121 commented May 2, 2017

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.

@ryanoasis
Copy link
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 😊

@ryanoasis ryanoasis added this to the v0.9.1 milestone May 2, 2017
@ryanoasis ryanoasis self-assigned this May 2, 2017
@x4121
Copy link
Author

x4121 commented May 3, 2017

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

Thanks for the plugin btw 👍

@ryanoasis
Copy link
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 😆

@x4121
Copy link
Author

x4121 commented May 6, 2017

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

@ryanoasis
Copy link
Owner

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

@x4121
Copy link
Author

x4121 commented May 7, 2017

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

But nice to hear that 🙂

@ryanoasis
Copy link
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? 😊

@ryanoasis
Copy link
Owner

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

@x4121
Copy link
Author

x4121 commented May 7, 2017

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.

@ryanoasis
Copy link
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]'

@ryanoasis
Copy link
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

@x4121
Copy link
Author

x4121 commented May 7, 2017

Already checked, works like a charm 🙂

@x4121 x4121 closed this as completed May 7, 2017
@ryanoasis
Copy link
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 😊

@x4121
Copy link
Author

x4121 commented May 7, 2017

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 😉

@ryanoasis
Copy link
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.

@x4121
Copy link
Author

x4121 commented May 7, 2017

@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
Projects
None yet
Development

No branches or pull requests

2 participants