Exploring files and directories in vim with the NERD tree plugin
Exploring, opening, switching, renaming, moving files and directories are common tasks performed during coding. In IDEs it is usually achieved with some kind of filesystem explorer. In vim I preffer to use the NERD tree plugin.
NERD Tree features
NERD tree enables you to:
- Navigate and jump through the directory tree
- Open files in the current window, tab, split view (horizontal and vertical)
- Change the current working directory
- Add, move, copy and remove files and directories
- Filter the tree
- Create the bookmarks
Installation
Get the source from the plugin website and unzip it into your ~/.vim directory.
To make using NERD tree more convenient it's best to create a shortcut mapping. To use ctrl+n add the following line to your ~/.vimrc file:
nmap <silent> <c-n> :NERDTreeToggle<CR>
Usage
Run vim and type :NERDTreeToggle or ctrl+n. The later will work only if you've created a mapping. NERD tree should open and present you the directory structure.
I'd suggest you to start with pressing the ? to read a quick help and learn about the plugin features.
Comments
about 1 year ago wrote:very interesting script. I'm a big fan of vim myself.
about 1 year ago wrote:Heya, Great article, what colorscheme is that? its really nice on the eyes.
about 1 year ago wrote:@codo I'm not sure now as those schemes look different depending on your terminal. I've been experimenting with themes for quite a time.
It might be that theme on the screens is "darktango". "desert" is another calm one.
about 1 year ago wrote:how to display command completion on status line as see at e.g 2:17 for BookmarkToRoot command
about 1 year ago wrote:Jacub how to display command completion at status bar on press as I see at 2:12
about 1 year ago wrote:@pawcik It's called wildmenu. Use 'set wildmenu' to turn it on. Check out my vim configuration for more: http://github.com/jakzal/vip
11 months ago wrote:I had to add this too to my .vimrc:autocmd VimEnter * NERDTreeas described athttp://stackoverflow.com/questions/1447334/how-do-you-add-nerdtree-to-your-vimrc
11 months ago wrote:Hi, this is a very nice plugin. I found the video in youtube followed the link to this blog. Is there a way to change the width of the sidebar of the NERDTree. When I use it within a console (ctrl-alt-F*) the width is too large. So I would like to change the width. Please let me know if this width can be changed. Thanks.
11 months ago wrote:Hi, I'm sorry for posting multiple times. My browser acted weird and did not send the comment the first time so I pressed the send multiple times and it got posted multiple time.
11 months ago wrote:@jailed no problem, i removed duplicates.
You can change NERDTree's window size by putting "let g:NERDTreeWinSize = 30" into your .vimrc file.- Write a comment



















