Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

3 Answers 3

up vote 7 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

Your Answer

 
discard

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.