Skip to main content
60 votes
Accepted

How do I open and close NERDTree (toggle NERDTree view) using a single keystroke?

In your vimrc add nmap <F6> :NERDTreeToggle<CR> where <F6> is the key you want to map.
Atropo's user avatar
  • 726
28 votes

How do I open and close NERDTree (toggle NERDTree view) using a single keystroke?

To open NerdTree : :NERDTreeFocus To switch beetween nerdtree and file opened windows : ctrl + ww (double w) or ctrl + w + (h/j/k/l) To close NerdTree (in nerdtree window) : :q
Ardi Nusawan's user avatar
9 votes
Accepted

Change buffer focus on enter?

You can change your autocommand to execute <c-w>w after executing NERDTree. To do so you can use wincmd which is the equivalent of pressing <C-w> but with a command (see :h :wincmd) ...
statox's user avatar
  • 50.2k
8 votes

Stop CtrlP from opening in NERDTree

Finally found a way to do this that doesn't involve closing NERDTree all the time. I made a function that cycles through the open windows until it finds a writable buffer, then runs ctrl-p there: ...
DJ Madeira's user avatar
7 votes
Accepted

Start NERDTree when gVim starts empty

The list of filename arguments can be obtained by calling argv(), so you could put something like this in your ~/.vimrc: if empty(argv()) NERDTree endif Note that putting a command in your ~/....
garyjohn's user avatar
  • 6,379
7 votes

How do I open and close NERDTree (toggle NERDTree view) using a single keystroke?

This would do exactly what you've asked for: nnoremap <silent> <expr> <F6> g:NERDTree.IsOpen() ? "\:NERDTreeClose<CR>" : bufexists(expand('%')) ? "\:NERDTreeFind<CR>" : "...
AdUki's user avatar
  • 171
6 votes

How to execute xdg-open from NERDTree in Linux?

For those curious, if NerdTree can xdg-open: Yes it can. Put the cursor on the desired file. Press m for the context menu. Press o to open in the system editor. Enjoy.
DeltaT's user avatar
  • 61
6 votes
Accepted

Execute a file from nerdTree

In NERDTree, press m to bring up the NERDTree Menu, and then you should see an option, labeled o, to open the current node with the system editor associated with that file or directory. If that doesn'...
Phil R's user avatar
  • 513
5 votes
Accepted

Disable Lightline on Nerdtree

It's a hack, but you could try this: augroup filetype_nerdtree au! au FileType nerdtree call s:disable_lightline_on_nerdtree() au WinEnter,BufWinEnter,TabEnter * call s:...
user938271's user avatar
  • 5,987
5 votes
Accepted

Nerdtree going to specific directory

Use Vim's built-in :cd command to change directory, followed by the NERDTree CD command (note: that's a normal-mode mapping, not an Ex : command.) So start with: :cd ~/my/directory/here (Note that ...
filbranden's user avatar
  • 29.1k
4 votes
Accepted

Close all windows except the current one and NERDTree

This solution only works with vim 8+ You can add this to your .vimrc: function! OnlyAndNerdtree() let currentWindowID = win_getid() windo if win_getid() != currentWindowID && &...
statox's user avatar
  • 50.2k
4 votes

How to set up NERDTree to CD to current folder when opening it for the first time via :NERDTreeFind

Use :set autochdir command to change the current directory. It will set the working directory as specific to the opened file.
Prakhil TP's user avatar
4 votes

Stop CtrlP from opening in NERDTree

I've tripped on this one too many times too: I've solved it by remapping the <c-p> to closing NERDTree (if open) and then opening CtrlP. Put this in your .vimrc: let g:ctrlp_map = '' ...
jonasl's user avatar
  • 141
4 votes
Accepted

sourcing .vimrc file put square brackets around file icons

Putting this in your vimrc should fix the re-source issue: " after a re-source, fix syntax matching issues (concealing brackets): if exists('g:loaded_webdevicons') call webdevicons#refresh() ...
Ryan L McIntyre's user avatar
4 votes
Accepted

A side pane file explorer that can list files by modification dates?

If you use the netrw plugin (which is included by default in recent versions), you can sort by date. Start netrw with the command :Ex (or :Vex to make it open as vertical split or "side pane" as you ...
Tumbler41's user avatar
  • 7,766
4 votes
Accepted

how to split panes (vertically and horizontally) straight from nerdree

The linked question asks how to jump directly from File 3 window to NERDTree window without hopping through File 1 or File 2 window first. The OP's solution is to use the mouse to click on the ...
B Layer's user avatar
  • 20k
4 votes

How to show all LaTeX code but still have set conceallevel=3 for vim-devicons and NERDTree?

I found the answer to my own question after hours of hunting. This post sheds light on the issue: https://stackoverflow.com/questions/18160953/disable-latex-symbol-conversion-in-vim It's resolved ...
Incalculon's user avatar
4 votes
Accepted

NERDTreeMenu Remapping

if you look at the documentation (:help NERDTree-t), you'll see that each of the command have a name and a default key. To remap for example NERDTreeMapUpdir to the 'a' key, you just have to add to ...
godot's user avatar
  • 256
4 votes

Easily add/open a file in the same folder as the current file/buffer

:Ex<CR> followed by % will prompt you for a new filename in that directory, which can be a pretty smooth process. Note that there's also set autochdir if that fits your patterns/plugins better (...
Rich Churcher's user avatar
4 votes

when viewing the nerdtree window, how can i widen it?

In the Vim vocabulary what you call a "pane" is actually a "window" and the window you want to resize has nothing particular so :h window-resize should give you all you need, ...
statox's user avatar
  • 50.2k
3 votes
Accepted

How to hide NERDTree when vim called with -R option?

Instead of just asking if there are no arguments, you could also ask if the buffer is empty. If you substitute !argc() in your autocmd by !argc() && bufnr('$') == 1 && line('$') == 1 &...
Ingo's user avatar
  • 986
3 votes

A side pane file explorer that can list files by modification dates?

You could use netrw's :Lexplore command (usually shortened to :Lex) to get a side pane. As Tumbler41 said, you can change the sorting order with s; you can also have netrw start up with that sorting ...
user21497's user avatar
  • 811
3 votes

How do I open and close NERDTree (toggle NERDTree view) using a single keystroke?

If you're stuck with a Mac with the absent function keys (touchbar), you can toggle NERDTree by mapping the Ctrl key like so within your .vimrc file: map <C-n> :NERDTreeToggle<CR> Save ...
Jason Gilmore's user avatar
3 votes

Stop CtrlP from opening in NERDTree

From @jonasl answer, you could also do: let g:ctrlp_cmd = ':NERDTreeClose\|CtrlP'
cmcginty's user avatar
  • 170
3 votes

How to execute xdg-open from NERDTree in Linux?

I figure out the reason why this plugin doesn't work: git clone https://github.com/aufgang001/vim-nerdtree_plugin_open.git ~/.vim/vim-nerdtree_plugin_open.git The instruction is wrong, it should ...
林果皞's user avatar
  • 237
3 votes
Accepted

How to change NERDTree plugin window continuously

In Vim you can press Ctrl+w, < or > to decrease and increase window width, respectively. Add comfortable mappings for you, I use the arrow keys, as follows: nnoremap <Up> :resize +2<CR&...
rafi's user avatar
  • 211
3 votes
Accepted

Weird behavior of NERDTreeFind function

Judging by the documentation, NERDTreeFind is a command, not a function. This means you do not need :call. nnoremap <silent> <leader>y :NERDTreeFind<cr>
Peter Rincker's user avatar
3 votes
Accepted

Unable to Open NERDTree

The problem is that when you invoke your Tabularize mapping, the : in the right-hand-side of the mapping is remapped to a ; by your colon map, and the keystrokes that are then invoked are: ;...
Rich's user avatar
  • 32.3k
3 votes

Can I open a file in a new tab with ctrl + return in NERDTree?

It's right there in the NERDTree help. Like it says at the top of the NERDTree window: Press ? for help " File node mappings~ " double-click,<CR>,o: open in prev window " t: open in new tab " T:...
B Layer's user avatar
  • 20k
3 votes
Accepted

NERDTree is not displayed in buffer list

NERDTree does a great many things that are... unvim-like... in order to give the IDE “project drawer” experience. I consider most of them hacks, and I’m wary of a plugin which has to hack around ...
D. Ben Knoble's user avatar
  • 26.8k

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