Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Defer autocmd creation until all plugins are loaded

This update ensures that Powerline's autocmds aren't created until vim
has loaded all plugins and settings, to avoid errors with plugins that
are loaded after Powerline. The VimEnter event is used to accomplish
this.

Closes #152.
Refs majutsushi/tagbar#77.
  • Loading branch information...
commit abd080b4dc5a75212b17e32fd50c0a7c0f603820 1 parent 99bce55
Kim Silkebækken Lokaltog authored
Showing with 19 additions and 11 deletions.
  1. +19 −11 plugin/Powerline.vim
30 plugin/Powerline.vim
View
@@ -42,20 +42,28 @@
endif
" }}}
" Autocommands {{{
- augroup Powerline
- autocmd!
+ function! s:CreateAutocmds()
+ augroup PowerlineMain
+ autocmd!
+
+ " Reload statuslines when changing color scheme
+ autocmd ColorScheme *
+ \ call Pl#Load()
- " Reload statuslines when changing color scheme
- au ColorScheme *
- \ call Pl#Load()
+ autocmd BufEnter,WinEnter,FileType,BufUnload *
+ \ call Pl#UpdateStatusline(1)
- au BufEnter,WinEnter,FileType,BufUnload *
- \ call Pl#UpdateStatusline(1)
+ autocmd BufLeave,WinLeave *
+ \ call Pl#UpdateStatusline(0)
- au BufLeave,WinLeave *
- \ call Pl#UpdateStatusline(0)
+ autocmd BufWritePost */autoload/Powerline/Colorschemes/*.vim
+ \ :PowerlineReloadColorscheme
+ augroup END
+ endfunction
+
+ augroup PowerlineStartup
+ autocmd!
- au BufWritePost */autoload/Powerline/Colorschemes/*.vim
- \ :PowerlineReloadColorscheme
+ autocmd VimEnter * call s:CreateAutocmds() | call Pl#UpdateStatusline(1)
augroup END
" }}}
Please sign in to comment.
Something went wrong with that request. Please try again.