2

I want to keep NERDTree always available at left (since vim starts).

NERDTree documentations has nothing relating to this and I don't think it has such inbuilt feature.

Well I tried setting by my own and did this:

autocmd VimEnter * NERDTree

But this seems buggy, the annoying things I found are:

  1. At startup the cursor is focused at NERDTree, it should be at editor window instead.
  2. When closing (with :q) the editor window closes, but the NERDTree is focused (I want to quit immediately, no wait!)

Do you have any better idea than this?

Santosh Kumar
  • 26,475
  • 20
  • 67
  • 118
  • 1
    See this http://stackoverflow.com/questions/1979520/auto-open-nerdtree-in-every-tab. Your problem 1 had been solved there. – halfelf Sep 23 '12 at 15:06
  • Yes, stop trying to turn Vim into an IDE: it's a hopeless endeavour. – romainl Sep 23 '12 at 18:57

1 Answers1

0

For 1., add an instruction to go back to the previous window:

autocmd VimEnter * execute 'NERDTree' | wincmd p

For 2., you could just use :qa; to automate that, you have to define an autocmd that checks whether the last remaining window is from NERDTree, something like this (untested):

autocmd WinEnter * if winnr('$') == 1 && exists("t:NERDTreeBufName") && bufwinnr(t:NERDTreeBufName) == 1 | quit | endif
Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324