Brad T.
Brad T.

Reputation: 252

Running NERDTree upon opening a new tab in Vim

I'm using the vim plugin NERDTree, and I have the following command in my vimrc file so that nerdtree automatically 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?

Upvotes: 5

Views: 4155

Answers (1)

Andrey Vlasovskikh
Andrey Vlasovskikh

Reputation: 16858

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

Upvotes: 6

Related Questions