Command line like navigation in NerdTree? #66

Closed
johncch opened this Issue May 25, 2011 · 3 comments

Projects

None yet

5 participants

johncch commented May 25, 2011

Just a thought. Something I've been thinking about quite often and like to make a request to see if anyone has a solution or if it can be a potential feature request.

Many times my projects are housed in a folder buried deep inside my home folder. Currently, NERDTree defaults to ~, so navigating to the folder requires some amount of keyboard acrobatics. I've always wished for a way to simply navigate to a folder ala command line cd and I'm wondering if there's a way to do it.

I agree. It would be nice to be able to use a `cd' like command to navigate within NERDtree. Or, allow usage of a vim :cd command to change the relative directory that NERDtree uses.

blueyed commented May 27, 2011

There is :NERDTreeFind if you are at a specific file already, and I am using the following map to open NERDTree in the current dir:

noremap <Leader>n. :execute "NERDTree ".expand("%:p:h")<cr>

In general, I tend to ":cd ", going to some previous dirs, and then start NERDTree from there. Although I am using Command-T and tmru more often to access specific files.

For what it's worth, here are my NERDTree mappings, hopefully it's good for some ideas at least:

noremap <Leader>n :NERDTree<space>
noremap <Leader>n. :execute "NERDTree ".expand("%:p:h")<cr>
noremap <Leader>nb :NERDTreeFromBookmark<space>
noremap <Leader>nn :NERDTreeToggle<cr>
noremap <Leader>no :NERDTreeToggle<space>
noremap <Leader>nf :NERDTreeFind<cr>
noremap <Leader>nc :NERDTreeClose<cr>

Also, look into NERDTree bookmarks, and my nb mapping. This will tab-complete.

Owner

nerdtree opens up in vims current working dir if no directory is given to the :NERDTree command. So you could just :cd to the project dir before opening up a nerdtree. Or start vim in the project directory in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment