Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Nice and simple, I'd like for NERDTree not to get involved when vim is invoked by git, for example when authoring a commit message or dealing with a rebase.

Presumably this is achievable by way of some kind of filetype detection (gitcommit etc), but precisely how to do it I have no idea. The relevant parts of my vimrc at the moment are:

autocmd vimenter * NERDTree
map <C-n> :NERDTreeToggle<CR>

I wish to retain the auto-opening of NERDTree in the general case. I've tried something along the lines of:

autocmd FileType gitcommit NERDTreeToggle

However the docs would suggest VimEnter as pretty much the last thing to fire after all buffers have been loaded etc, so I guess that's why this doesn't work.

Thanks in advance.

share|improve this question
    
Do you really need that window open at all times? –  romainl Feb 19 '13 at 20:27

1 Answer 1

up vote 1 down vote accepted

I think you already have all the pieces together: Just combine the launch of NERDTree with a conditional on the filetype; when VimEnter fires, this should already be set:

:autocmd VimEnter * if &filetype !=# 'gitcommit' | NERDTree | endif
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.