Hot answers tagged nerdtree
I use the following mapping to view the current buffer in NERDTree: map <leader>r :NERDTreeFind<cr>
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 ...
Got impatient, looked at the docs. Solved by putting let NERDTreeQuitOnOpen = 1 in my .vimrc.
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)
You want to use the NERDTreeIgnore option, for example: let NERDTreeIgnore=['\.o$', '\~$'] Do :help NERDTreeIgnore for more information.
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>
Vim: How to synchronize NERDTree with current opened tab file path? the map <leader>r :NERDTreeFind<cr> answer works for me.
Try :help NERDTreeChDirMode. Setting it to 2 will do what you want.
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., ...
: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.
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.
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".
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 ...
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 ...
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:\. ...
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.
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.
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 ...
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.
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 ...
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.
It seems you are looking for the option NERDTreeHijackNetrw, as explained in the NERDTree documentation: If set to 1, doing a :edit <some directory> will open up a "secondary" NERD tree instead of a netrw in the target window. Secondary NERD trees behaves slightly different from a regular trees in the following respects: 1. 'o' will open the selected ...
Turns out this was because I was on a more "exotic" shell. set shell=/bin/bash did the trick for me.
Add a custom mapping to your ~/.vimrc: nnoremap <F9> :NERDTreeToggle /path/to/directory The set autochdir option may pick your interest, BTW.
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
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. ...
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>. ...
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 ...
The general "always open NERDTree" behavior is added by NERDTreeTabs, and you can disable it by adding the following line to your .gvimrc file: let g:nerdtree_tabs_open_on_gui_startup = 0 (There's also an equivalent option for console startup, but it already defaults to 0.) Then, from the NERDTree README: Q. How can I open a NERDTree automatically ...
:NERDTree /path/to/dir opens NERDTree in the specified directory. It is generally a better idea to start Vim in the directory you wich to work in, though.
Only top voted, non community-wiki answers of a minimum length are eligible