Search code examples
vimnerdtree

NERDTree Load Particular Directory Automatically


I'm using gvim in windows.By default nerdtree loads C:\ drive as default.I like to change it to E:\ drive.How to achieve this?

Whenever I try to start NERDTree using :NERDTree command, I get this error E492: Not an editor command: NERDTree


Solution

  • I have the following code in my vimrc file

    cd ~/documents
    map <F2> :NERDTreeToggle<CR>
    " open Nerd Tree in folder of file in active buffer
    map <Leader>nt :NERDTree %:p:h<CR>
    

    The cd command is not NerdTree specific. It just changes the working directory when Vim starts to something which for me is sensible.