vim-plug icon indicating copy to clipboard operation
vim-plug copied to clipboard

Fail to on-demand loading

Open zaixi opened this issue 9 years ago • 1 comments

Open the file after moving the cursor status bar does not change, airline is not loaded. But after opening the file and then use: vsp README.md normal loading of the airline.

my .vimrc

set laststatus=2
set updatetime=10
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call plug#begin('~/.vim/bundle')
Plug 'bling/vim-airline',{'on' : []}
augroup load_write
  autocmd!
  autocmd cursorhold * call plug#load('vim-airline')
                                         \| autocmd! load_write
  autocmd cursorhold * :autocmd! load_write
augroup end
call plug#end()

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 22 2017 12:01:24)
包含补丁: 1-577
编译 者 liyj
超强版本 带 GTK2 图形界面。  目前可使用(+)与不可使用(-)的模块列表:
+acl             +cscope          -footer          +menu            +num64           +startuptime     +virtualedit
+arabic          +cursorbind      +fork()          +mksession       +packages        +statusline      +visual
+autocmd         +cursorshape     +gettext         +modify_fname    +path_extra      -sun_workshop    +visualextra
+balloon_eval    +dialog_con_gui  -hangul_input    +mouse           -perl            +syntax          +viminfo
+browse          +diff            +iconv           +mouseshape      +persistent_undo +tag_binary      +vreplace
++builtin_terms  +digraphs        +insert_expand   +mouse_dec       +postscript      +tag_old_static  +wildignore
+byte_offset     +dnd             +job             -mouse_gpm       +printer         -tag_any_white   +wildmenu
+channel         -ebcdic          +jumplist        -mouse_jsbterm   +profile         -tcl             +windows
+cindent         +emacs_tags      +keymap          +mouse_netterm   +python/dyn      +termguicolors   +writebackup
+clientserver    +eval            +lambda          +mouse_sgr       +python3/dyn     +terminfo        +X11
+clipboard       +ex_extra        +langmap         -mouse_sysmouse  +quickfix        +termresponse    -xfontset
+cmdline_compl   +extra_search    +libcall         +mouse_urxvt     +reltime         +textobjects     +xim
+cmdline_hist    +farsi           +linebreak       +mouse_xterm     +rightleft       +timers          +xpm
+cmdline_info    +file_in_path    +lispindent      +multi_byte      +ruby            +title           +xsmp_interact
+comments        +find_in_path    +listcmds        +multi_lang      +scrollbind      +toolbar         +xterm_clipboard
+conceal         +float           +localmap        -mzscheme        +signs           +user_commands   -xterm_save
+cryptv          +folding         -lua             +netbeans_intg   +smartindent     +vertsplit
   系统 vimrc 文件: "$VIM/vimrc"
     用户的 vimrc 配置文件: "$HOME/.vimrc"
 第二用户 vimrc 文件: "~/.vim/vimrc"
      用户 exrc 文件: "$HOME/.exrc"
  系统 gvimrc 文件: "$VIM/gvimrc"
    用户 gvimrc 文件: "$HOME/.gvimrc"
第二用户 gvimrc 文件: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    系统菜单文件: "$VIMRUNTIME/menu.vim"
  $VIM 预设值: "/usr/share/vim"
编译方式: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu
/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/us
r/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I
/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-
gnu/glib-2.0/include -I/usr/include/freetype2   -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
链接方式: gcc   -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic  -L
/usr/local/lib -Wl,--as-needed -o vi   -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -
lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lSM -lICE -lXpm -lXt -lX11 -lXdmcp
 -lSM -lICE  -lm -ltinfo -lnsl  -lselinux   -ldl       -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm

  • Type:
    • [x] Bug
    • [ ] Enhancement
    • [ ] Feature Request
    • [ ] Question
  • OS:
    • [ ] All/Other
    • [x] Linux
    • [ ] OS X
    • [ ] Windows
  • Vim:
    • [x] Terminal Vim
    • [ ] GVim
    • [ ] Neovim

zaixi avatar Jul 15 '17 10:07 zaixi

Some plugins are activated on certain autocmd events, and vim-plug has no way to know that.

doautocmd WinEnter might help in this case, but I strongly advise against trying too hard to apply on-demand loading. On-demand loading, or lazy loading, provided by plugin managers are hacky workarounds, and are not guaranteed to work.

https://github.com/junegunn/vim-plug/wiki/faq#when-should-i-use-on-or-for-option

junegunn avatar Jul 15 '17 10:07 junegunn