ryanoasis / vim-devicons

Adds file type icons to Vim plugins such as: NERDTree, vim-airline, CtrlP, unite, Denite, lightline, vim-startify and many more
MIT License
5.62k stars 266 forks source link

Devicons - airline interface could be less than ideal... tabline shows devicons for conditional package loading, statusline does not #378

Open poetaman opened 3 years ago

poetaman commented 3 years ago

Required Info

Optional Info

Note This issue has been filed on vim-airline here, and on vim-plug here. This issue is filed here too as it could be in interface of devicons and vim-airline, or with the conditional plug loading scheme offered by vim-plug.

actual behavior

Devicons do not render in statusline, they render correctly in tabline for conditional plugin load feature of vim-plug. In case of vim running in terminal, reducing the size of terminal (to hide/fold the place where icons are to be rendered) and then expanding makes the icons appear in status line.

expected behavior

Given icons are rendering correctly in tabline, status line's code should be based on its model (sequence of events I guess) so they both render correctly.

Detailed example (also filed on vim-plug, just in case its a plugin load problem, we don't know yet):

Here's a very small test .vimrc in two flavors: 1) no conditional plugin load (.myvimrc1), 2) all plugs loaded conditionally on same trigger condition (.myvimrc2). We open two instances of vim, one each for the corresponding vimrc. One would expect the behavior of both vim instances to be same after triggering event happens in vim instance loaded with .myvimrc2. As can be seen below, the only difference between them its that devicons are not loaded in statusline of .myvimrc2, though they are loaded in tabline. For .myvimrc1's vim session, both statusline & tabline display devicons correctly. On further testing, I found that if reduce the size of the window to hide the region of statusline where devicons should have rendered, and enlarge the screen again... the icons appear. While this is definitely a bug for the interface between airline, and devicons, it is also a inquiry for vim-plug, and if there is a way to overcome this. I would appreciate an conditional load answer that works.

Screenshot for >> vim -u .myvimrc1 .myvimrc1:

Screen Shot 2021-02-03 at 6 51 21 AM

Screenshot for >> vim -u .myvimrc2 .myvimrc2 && :Mycmd<CR>

Screen Shot 2021-02-03 at 6 01 34 AM

Gif showing the behavior of .myvimrc2: airlinedevicon_compressed

source (.myvimrc2), command vim -u .myvimrc2 .myvimrc2

set nocompatible
set fileencoding=utf-8

function! Myfunc()
  call plug#load(keys(g:plugs))
endfunction

command Mycmd execute 'normal! :call Myfunc()<CR>'

call plug#begin('~/.vim/plugged')
  Plug 'vim-airline/vim-airline', {'on':'Mycmd'}
  Plug 'vim-airline/vim-airline-themes', {'on':'Mycmd'}
  Plug 'ryanoasis/vim-devicons', {'on':'Mycmd'}
call plug#end()

if !exists('g:airline_symbols')
  let g:airline_symbols = {}
endif
let g:airline_symbols.space = "\ua0"
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1

source (.myvimrc1), command vim -u .myvimrc1 .myvimrc1

set nocompatible
set fileencoding=utf-8

function! Myfunc()
  call plug#load(keys(g:plugs))
endfunction

command Mycmd execute 'call Myfunc()'

call plug#begin('~/.vim/plugged')
  Plug 'vim-airline/vim-airline'
  Plug 'vim-airline/vim-airline-themes'
  Plug 'ryanoasis/vim-devicons'
call plug#end()

if !exists('g:airline_symbols')
  let g:airline_symbols = {}
endif
let g:airline_symbols.space = "\ua0"
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Dec 28 2020 07:15:57)
macOS version
Included patches: 1-2164
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl               -ebcdic            +localmap          +printer           +timers
+arabic            +emacs_tags        +lua               +profile           +title
+autocmd           +eval              +menu              -python            +toolbar
+autochdir         +ex_extra          +mksession         +python3           +transparency
-autoservername    +extra_search      +modify_fname      +quickfix          +user_commands
+balloon_eval      -farsi             +mouse             +reltime           +vartabs
+balloon_eval_term +file_in_path      +mouseshape        +rightleft         +vertsplit
+browse            +find_in_path      +mouse_dec         +ruby              +virtualedit
++builtin_terms    +float             -mouse_gpm         +scrollbind        +visual
+byte_offset       +folding           -mouse_jsbterm     +signs             +visualextra
+channel           -footer            +mouse_netterm     +smartindent       +viminfo
+cindent           +fork()            +mouse_sgr         -sound             +vreplace
+clientserver      +fullscreen        -mouse_sysmouse    +spell             +wildignore
+clipboard         +gettext           +mouse_urxvt       +startuptime       +wildmenu
+cmdline_compl     -hangul_input      +mouse_xterm       +statusline        +windows
+cmdline_hist      +iconv             +multi_byte        -sun_workshop      +writebackup
+cmdline_info      +insert_expand     +multi_lang        +syntax            -X11
+comments          +ipv6              -mzscheme          +tag_binary        -xfontset
get-me-power commented 3 years ago

Thanks for your report.

Why do you need to lazy load vim-airline and vim-devicons in the first place? Lazy loading is a hack, and sometimes breaks the behavior of plugins. It's possible that these plugins are not designed for such use cases.

Please also see this issue. I completely agree with this opinion.

https://github.com/vim-airline/vim-airline/issues/2327