Tag Info

Hot answers tagged

44

I use the following mapping to view the current buffer in NERDTree: map <leader>r :NERDTreeFind<cr>


13

I found both the existing answers educational, and successfully combined the two so that the behavior is more like many people would expect from an IDE: Click on an open window/buffer, and have that file highlighted in the NERDTree. I put this in my ~/.vimrc: autocmd BufEnter * if &modifiable | NERDTreeFind | wincmd p | endif What this does: autocmd ...


11

This one liner from scrooloose on this thread fixed it: let g:NERDTreeDirArrows=0 Try putting that in your .vimrc (see also: same answer posted here on Stack Overflow)


10

Got impatient, looked at the docs. Solved by putting let NERDTreeQuitOnOpen = 1 in my .vimrc.


10

You want to use the NERDTreeIgnore option, for example: let NERDTreeIgnore=['\.o$', '\~$'] Do :help NERDTreeIgnore for more information.


9

throw a % sign on the end like a boss :NERDTree % i have this in my .vimrc, it maps Ctrl+o to toggle nerdtree in the dir of the current buffer: map <C-o> :NERDTreeToggle %<CR>


8

Try :help NERDTreeChDirMode. Setting it to 2 will do what you want.


7

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


7

Vim: How to synchronize NERDTree with current opened tab file path? the map <leader>r :NERDTreeFind<cr> answer works for me.


5

There are a couple of ways to give Vim keypresses in a command. The general way is to use the :normal command, which in this case would be :execute "normal \<C-W>\<C-W>" where the :execute command is needed to expand the control characters. For normal commands that begin with Ctrl-W, however, the :wincmd command can be simpler to use, e.g., ...


5

I'm having a similar problem using Vim 7.2 and the latest NERDtree plugin (4.2.0). The odd symbols are because your terminal does not support the new arrows. You can fix that by putting let NERDTreeDirArrows=0 in your .vimrc I'm still working on the the more important issue of it not opening directories though.


4

The command is :NERDTree—case does matter, especially since only internal Vim commands can start with a lowercase letter. If you followed the installation instructions you should be able to do ":help NERD_Tree.txt". If not, do ":helptags ~/.vim/doc".


4

Windows's file systems (FAT, FAT32, NTFS) all have directory entries . and .. in each directory, which correspond to the current and the parent directory, respectively. From the Microsoft EFI FAT32 File System Specification: When a directory is created, [...] [i]f the directory is not the root directory, you need to create two special entries in the ...


4

By default, NERDTree starts in the current working directory. You've probably started Vim through the installed Start Menu shortcut, which defaults to the system32 directory. (You can check from inside Vim with :pwd.) I would recommend that you modify the shortcut that starts GVIM (gvim.lnk: right mouse button > Properties > Start in:) to start in M:\. ...


3

I've solved the problem. What I did to solve it: Edited /etc/locale.gen to LC_ALL="en_US.UTF-8" instead of LC_ALL="en_US" Ran locale-gen as root Ran locale -a, it showed en_US.UTF-8; however, locale showed LC_ALL still being en_US, then I remembered I had exported LC_ALL in my .bashrc last night trying to fix this, so I changed my LANG and LC_ALL to ...


3

I'm not sure if there's a NERDTree-specific way to do that, but you can always configure Vim so that it sets the working directory to the current file's directory: autocmd BufEnter * lcd %:p:h Now all what you have to do after opening a file in a new tab is :NERDTreeToggle in the new tab itself.


2

I came across this question yesterday, after a few hours of digging, I submited a Pull Request to scrooloose's nerdtree repo introducing a NERDTreeCWDcommand that change NERD tree root to current working directory(Update on 2012-11-12: The PR has been merged into the upstream master,it should be usable on an updated version). With this change, this question ...


2

The alternate plugin can create a split with the pair file. You can probably add you own key mappings to NERDTree.vim to do this automatically.


2

I was looking for a solution for doing this automatically on every BufEnter. The naive approach didn't work as I couldn't leave my NERDTree anymore :-) - NERDTreeFind changes the window to the NERDTree and when you go back to the window with the file, it triggers again. I found my solution in: http://superuser.com/a/474298/175466, but I had a slight problem ...


2

NERDtree doesn't offer this feature but you can do :bp to reopen the previous buffer if it's still in the buffer list or use Vim's jump list (:h jump) with <C-o> and <C-i>. Another solution, if you want to reach those files often, would be to use NERDTree's bookmarking feature. A few plugins offer some kind of MRU (Most Recently Used) abilities. ...


2

The filename is not present in NERDTree's buffer so /pattern won't work. You'll have to use other tools to reach your goal. If the file is in a directory that is part of Vim's path you can use :find like that: :find filename :find fil<Tab> :find pattern See :help path for how to add directories. You can also do :e /path/to/directory<Tab>. ...


2

Maybe this is not worth a hack but it seems it worked for me. I changed the line in NERDTree.vim: call s:initVariable("g:NERDTreeDirArrows", s:running_windows) (it was !s:running_windows before) Now I don't see any fancy + symbol, but at least jumping directories works from within vim. I'm on solaris and I don't think I have root access.


2

Add a custom mapping to your ~/.vimrc: nnoremap <F9> :NERDTreeToggle /path/to/directory The set autochdir option may pick your interest, BTW.


1

I think you already have all the pieces together: Just combine the launch of NERDTree with a conditional on the filetype; when VimEnter fires, this should already be set: :autocmd VimEnter * if &filetype !=# 'gitcommit' | NERDTree | endif


1

No. The mouse option is enabled/disabled globally.


1

Try this. map <F5> :NERDTree<cr><c-w>p


1

To answer your first question: A very basic overview of the recursive contents of the current directory can be found with find: mtak@frisbee:~/Documents/vagrant$ find . . ./.vagrant ./.vagrant/machines ./.vagrant/machines/default ./.vagrant/machines/default/virtualbox ./precise32 ./precise32/Vagrantfile ./BuildRaring ./BuildRaring/Vagrantfile ...


1

You're looking for the cd mapping. Type this inside the NERDTree sidebar, and the current directory will be changed to the current entry's. See :help NERDTree-cd.


1

Turns out this was because I was on a more "exotic" shell. set shell=/bin/bash did the trick for me.


1

Try the following Add this map to your vimrc nmap <Leader>b :NERDTreeFind<CR> This you can do the following from an open file < Leader >b => highlight the file in NerdTree m => display the file options r => reveal in Finder The above assumes you're running a GUI like MacVim for example. If you're in the shell you can add this to your ...



Only top voted, non community-wiki answers of a minimum length are eligible