Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

TPluginVimEnter(): :do VimEnter commands only if such autocommands ar…

…e defined
  • Loading branch information...
commit 940eb5d6358862fb1b4468013059301b6283532d 1 parent 152235c
Tom Link authored February 23, 2012
6  autoload/tplugin.vim
@@ -3,8 +3,8 @@
3 3
 " @GIT:         http://github.com/tomtom/tplugin_vim/
4 4
 " @License:     GPL (see http://www.gnu.org/licenses/gpl.txt)
5 5
 " @Created:     2010-09-17.
6  
-" @Last Change: 2012-01-22.
7  
-" @Revision:    223
  6
+" @Last Change: 2012-02-23.
  7
+" @Revision:    226
8 8
 
9 9
 
10 10
 if !exists('g:tplugin#autoload_exclude')
@@ -368,7 +368,7 @@ function! s:ScanSource(file, repo, plugin, what, lines) "{{{3
368 368
                     let augroup = augroup0
369 369
                 endif
370 370
                 if !empty(augroup) && !empty(filebase) && !has_key(s:vimenter_augroups_done, augroup)
371  
-                    let cmd = 'TPluginAfter \V'. escape(filebase, '\') .' do '. augroup .' VimEnter'
  371
+                    let cmd = 'TPluginAfter \V'. escape(filebase, '\') .' call TPluginVimEnter("'. augroup .'")'
372 372
                     call add(out, cmd)
373 373
                     let s:vimenter_augroups_done[augroup] = 1
374 374
                 endif
12  macros/tplugin.vim
@@ -904,6 +904,18 @@ function! TPluginDependencies(repo, deps) "{{{3
904 904
 endf
905 905
 
906 906
 
  907
+function! TPluginVimEnter(group) "{{{3
  908
+    redir => aus
  909
+    exec 'silent au' a:group 'VimEnter'
  910
+    redir END
  911
+    let au = split(aus, '\n')
  912
+    " TLogVAR a:group, len(au)
  913
+    if len(au) > 1
  914
+        exec 'doautocmd' a:group 'VimEnter'
  915
+    endif
  916
+endf
  917
+
  918
+
907 919
 if index(['.vim', 'vimfiles'], expand("<sfile>:p:h:h:t")) != -1
908 920
     call TPluginAddRoots()
909 921
 else

0 notes on commit 940eb5d

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