7

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

Cheng
  • 1,413
  • 15
  • 18

3 Answers3

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.

Philippe Mongeau
  • 765
  • 2
  • 7
  • 16
0

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

:help NERDTreeFunctionality
Heptite
  • 19,383
  • 5
  • 58
  • 71
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()
cars
  • 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 '10 at 03:36