0

I have the following lines in my vimrc:

autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p

As a result the nerdtree plugin always opens when I load vim. How can I change the behaviour to load nerdtree iff vim is invoked from a particular directory.

For example, when open $ vim file.py from inside ~/workspace/something/ the loaded vim must load with nerdtree as I want any instance of vim involked from inside ~/workspace to have nerdtree loaded by default.

2

Editing the line to check for directory fixed my problem.

autocmd VimEnter */workspace/* NERDTree| wincmd p
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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