NERDTreeToggle opens in Windows/system32

Posted on

QUESTION :

I’ve added the following useful settign to _vimrc:

map <F2> :NERDTreeToggle<CR>

If I open gvim and then press F2 NERDTree will open but in the directory Windows/system32 which takes a long time to cache.

Can I change the setting so that it opens in M:. I’ve used help: NERDTreeToggle and from the help I’ve tried the following but it doesn’t seem to work:

:NERDTreeToggle M:

Maybe I need another setting so that only on start-up NERDTree will automatically start and be visible and open at M: – is this possible?

ANSWER :

By default, NERDTree starts in the current working directory. You’ve probably started Vim through the installed Start Menu shortcut, which defaults to the system32 directory. (You can check from inside Vim with :pwd.)

I would recommend that you modify the shortcut that starts GVIM (gvim.lnk: right mouse button > Properties > Start in:) to start in M:. That’s probably a better default for starting Vim, and it also solves the NERDTree problem.

Leave a Reply

Your email address will not be published. Required fields are marked *