Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 10 down vote accepted
: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.

share|improve this answer

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

:help NERDTreeFunctionality
share|improve this answer
It seems :NERDTree opens the pwd where VIM started. – Cheng Oct 18 '10 at 3:21

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

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

Your Answer


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.