I'm using the vim plugin NERDTree, and I have the following command in my vimrc file so that nerdtree a开发者_开发知识库utomatically runs when I open vim:
au VimEnter * NERDTree
However, when I create a new tab, I want NERDTreeMirror to run on the new tab (which, the command above isn't even running on new tabs so adding au VimEnter * NERDTreeMirror is ineffective). Is there something I can set in the vimrc file to run au VimEnter * NERDTreeMirror on new tabs when they're opened?
You may take a look at all the autocmd events using :help event
. There are several interesting events like TabEnter
and BufNew
.
By the way, it's more convenient for me to use F3 to toggle NERDTree in the current tab:
autocmd VimEnter * nmap <F3> :NERDTreeToggle<CR>
autocmd VimEnter * imap <F3> <Esc>:NERDTreeToggle<CR>a
let NERDTreeQuitOnOpen=1
let NERDTreeWinSize=35
精彩评论