7

Like what :Ve and :E did, but in NERDTree.

3 Answers 3

11
:NERDTree %

Works for me. % is the path to the current file, so you can't cd to %, but NERDTree interprets it intelligently and opens the folder instead of the file.

0

Do you want the ":NERDTree" / ":NERDTreeToggle" commands? Check out:

:help NERDTreeFunctionality
1
  • 1
    It seems :NERDTree opens the pwd where VIM started.
    – Cheng
    Oct 18, 2010 at 3:21
0

One way is to automatically cd to the current file always. This works with NERDTree.

http://vim.wikia.com/wiki/Change_to_the_directory_of_the_current_file

function AlwaysCD()
  if bufname("") !~ "^ftp://"
    lcd %:p:h
  endif
endfunction
autocmd BufEnter * call AlwaysCD()
1
  • I don't get it. Added to my .vimrc, nothing changed. I have to type lcd %:p:h, then opens :NERDTree?
    – Cheng
    Oct 18, 2010 at 3:36

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.