Vim plug conditional load behavior difference
- Dominant language
- Vim Script
- Stars
- 35.8k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
**Note This issue has been filed on [vim-airline](https://github.com/vim-airline/vim-airline) [here](https://github.com/vim-airline/vim-airline/issues/2327#issue-800484933), and on [devicons](https://github.com/ryanoasis/vim-devicons) [here](https://github.com/ryanoasis/vim-devicons/issues/378#issue-800504422). This issue is filed here too as it could be with the conditional plug loading scheme offered by [vim-plug](https://github.com/junegunn/vim-plug), or in interface of [devicons](https://github.com/ryanoasis/vim-devicons) and [vim-airline](https://github.com/vim-airline/vim-airline).**
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](https://github.com/devicons/devicon) are not loaded in statusline of .myvimrc2, though they are loaded in tabline. For .myvimrc1's vim session, both statusline & tabline display [devicons](https://github.com/devicons/devicon) correctly. On further testing, I found that if reduce the size of the window to hide the region of statusline where [devicons](https://github.com/devicons/devicon) should have rendered, and enlarge the screen again... the icons appear. While this is definitely a bug for the interface between [airline](https://github.com/vim-airline/vim-airline), and [devicons](https://github.com/ryanoasis/vim-devicons), it is also a inquiry for [vim-plug](https://github.com/junegunn/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`:

Screenshot for `>> vim -u .myvimrc2 .myvimrc2` && `:Mycmd`

Gif showing the behavior of .myvimrc2:

source (.myvimrc2), command `vim -u .myvimrc2 .myvimrc2`
```vim
set nocompatible
set fileencoding=utf-8
function! Myfunc()
call plug#load(keys(g:plugs))
endfunction
command Mycmd execute 'normal! :call Myfunc()'
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`
```vim
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
```
- Type:
- [x] Bug
- [x] Enhancement
- [ ] Feature Request
- [x] Question
- OS:
- [ ] All/Other
- [ ] Linux
- [x] OS X
- [ ] Windows
- Vim:
- [x] Terminal Vim
- [x] GVim
- [ ] Neovim
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.