Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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
1  
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.

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()
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .