A.J.Mechelynck wrote:
A.J.Mechelynck wrote:
[...]
IU mentioned the VimEnter event, which is triggered at the very end of
startup. It is of course possible that other scripts than your own
will set up VimEnter autocommands to create new autocommands in their
turn, but IMHO it is highly unlikely.
[...]
Oops, sorry, that one is _too_ late. But you can use a variant of the
same (untested):
augroup lastgroup
au BufReadPre * call SetUpLateAutocommand()
augroup END
function SetUpLateAutocommand()
au! lastgroup
au BufReadPost * call AfterSkeletons()
endfunction
function AfterSkeletons()
"
" ... whatever ...
"
endfunction
Actually, that's pretty good, but still doesn't address new files. It would
work for gvim if the lastgroup autocmd also hooked GUIEnter. But it doesn't
work for regular vim. Here's the events I'm seeing in that case:
SourcePre $VIM/vimrc
SourcePre $VIMRUNTIME/macmap.vim
SourcePre $VIMRUNTIME/autoload/paste.vim
SourcePre ~/.vimrc
SourcePre $VIMRUNTIME/filetype.vim
SourcePre $VIMRUNTIME/ftplugin.vim
SourcePre $VIMRUNTIME/indent.vim
SourcePre $VIMRUNTIME/syntax/syntax.vim
SourcePre $VIMRUNTIME/syntax/synload.vim
SourcePre $VIMRUNTIME/syntax/syncolor.vim
SourcePre $VIMRUNTIME/colors/desert.vim
SourcePre $VIMRUNTIME/syntax/syncolor.vim
SourcePre $VIMRUNTIME/syntax/syncolor.vim
SourcePre $VIMRUNTIME/syntax/syncolor.vim
ColorScheme ./foo
SourcePre ./.vimrc
SourcePre ./.exrc
SourcePre ~/.vim/plugin/a.vim
SourcePre ~/.vim/plugin/manpageview.vim
SourcePre ~/.vim/plugin/matchit.vim
SourcePre ~/.vim/plugin/showmarks.vim
SourcePre ~/.vim/plugin/svn.vim
SourcePre ~/.vim/plugin/svn_commit.vim
SourcePre ~/.vim/plugin/svncommand.vim
SourcePre ~/.vim/plugin/taglist.vim
SourcePre ~/.vim/plugin/vimballPlugin.vim
SourcePre $VIMRUNTIME/plugin/getscript.vim
SourcePre $VIMRUNTIME/plugin/gzip.vim
SourcePre $VIMRUNTIME/plugin/matchparen.vim
SourcePre $VIMRUNTIME/plugin/netrwPlugin.vim
SourcePre $VIMRUNTIME/plugin/rrhelper.vim
SourcePre $VIMRUNTIME/plugin/spellfile.vim
SourcePre $VIMRUNTIME/plugin/tarPlugin.vim
SourcePre $VIMRUNTIME/plugin/tohtml.vim
SourcePre $VIMRUNTIME/plugin/vimballPlugin.vim
SourcePre $VIMRUNTIME/plugin/zipPlugin.vim
SourcePre ~/.vim/after/plugin/test_after_plugin.vim
BufNewFile ./foo
BufWinEnter ./foo
TermResponse ./foo
VimEnter ./foo
FileChangedShellPost ./foo
CursorMoved ./foo
FileChangedShellPost ./foo
BufWinLeave ./foo
BufUnload ./foo
VimLeavePre ./foo
VimLeave ./foo
Note that there's nothing between the last SourcePre and BufNewFile. Interestingly
":help BufNew" doesn't mention any restrictions about which buffers it will
happen for, but I'm not seeing that event firing, which would be useful for your
suggested code.
It still looks like my only option is to try to be the absolutely last plugin
loaded.