Howe Chen
Howe Chen

Reputation: 163

how to make vim-nerdtree-tab auto start

I am the newer of vim, after installing the spf13, I got a problem.

I have installed the NERDTree and vim-NERDTree-tab, but I don'w know how to let vim-NERDTree-tab starts on every tabs I open in NERDTree, please help me for this question.

Upvotes: 1

Views: 2190

Answers (2)

Howe Chen
Howe Chen

Reputation: 163

Actually I got the answer:

if you use spf-13 for your vim as the customization.

You should do this:

vim .vimrc.local

Then add this:

let g:nerdtree_tabs_open_on_console_startup = 1
autocmd BufWinEnter * :NERDTreeTabsOpen
autocmd BufWinEnter * :NERDTreeMirrorOpen

and if you want the cursor focus on the content you want to edit, type this:

autocmd VimEnter * wincmd w

Upvotes: 0

Ingo Karkat
Ingo Karkat

Reputation: 172520

According to the documentation, this happens automatically in GVIM, but has to be enabled in terminal Vim:

g:nerdtree_tabs_open_on_gui_startup (default: 1)
Open NERDTree on gvim/macvim startup

g:nerdtree_tabs_open_on_console_startup (default: 0)
Open NERDTree on console vim startup

So, if that's the case (and you've installed the plugins correctly), just put this into your ~/.vimrc (or the equivalent in spf-13):

:let g:nerdtree_tabs_open_on_console_startup = 1

PS: There's also a :NERDTreeTabsOpen command for interactive use.

PPS: Vim "distributions" like spf-13 and Janus lure you with a quick install and out-of-the-box settings, but you pay the price with increased complexity (you need to understand both Vim's runtime loading scheme and the arbitrary conventions of the distribution) and inflexibility (the distribution may make some things easier, but other things very difficult). Vim is incredibly customizable, using someone else's customization makes no sense.

Upvotes: 3

Related Questions