Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 7f53b5c3919bde9a4259d0c725d453ef2337a4ed 1 parent fd3cd90
Kim Silkebækken authored June 25, 2012

Showing 1 changed file with 19 additions and 11 deletions. Show diff stats Hide diff stats

  1. 30  plugin/Powerline.vim
30  plugin/Powerline.vim
@@ -42,20 +42,28 @@
42 42
 	endif
43 43
 " }}}
44 44
 " Autocommands {{{
45  
-	augroup Powerline
46  
-		autocmd!
  45
+	function! s:CreateAutocmds()
  46
+		augroup PowerlineMain
  47
+			autocmd!
  48
+
  49
+			" Reload statuslines when changing color scheme
  50
+			autocmd ColorScheme *
  51
+				\ call Pl#Load()
47 52
 
48  
-		" Reload statuslines when changing color scheme
49  
-		au ColorScheme *
50  
-			\ call Pl#Load()
  53
+			autocmd BufEnter,WinEnter,FileType,BufUnload *
  54
+				\ call Pl#UpdateStatusline(1)
51 55
 
52  
-		au BufEnter,WinEnter,FileType,BufUnload *
53  
-			\ call Pl#UpdateStatusline(1)
  56
+			autocmd BufLeave,WinLeave *
  57
+				\ call Pl#UpdateStatusline(0)
54 58
 
55  
-		au BufLeave,WinLeave *
56  
-			\ call Pl#UpdateStatusline(0)
  59
+			autocmd BufWritePost */autoload/Powerline/Colorschemes/*.vim
  60
+				\ :PowerlineReloadColorscheme
  61
+		augroup END
  62
+	endfunction
  63
+
  64
+	augroup PowerlineStartup
  65
+		autocmd!
57 66
 
58  
-		au BufWritePost */autoload/Powerline/Colorschemes/*.vim
59  
-			\ :PowerlineReloadColorscheme
  67
+		autocmd VimEnter * call s:CreateAutocmds() | call Pl#UpdateStatusline(1)
60 68
 	augroup END
61 69
 " }}}

0 notes on commit 7f53b5c

Please sign in to comment.
Something went wrong with that request. Please try again.