Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running NERDTree upon opening a new tab in Vim

Tags:

vim

nerdtree

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?

like image 440
Brad T. Avatar asked Jul 08 '11 21:07

Brad T.


1 Answers

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
like image 163
Andrey Vlasovskikh Avatar answered Sep 24 '22 13:09

Andrey Vlasovskikh