Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NERDTree toggling and keyboard mapping

Tags:

vim

nerdtree

I have this line in my .vimrc:

nmap <silent> <Leader>p :NERDTreeToggle<CR>

So what is the hotkey for toggling NERDTree?

How do I remap it to CTRL-D?

what is the difference between nmap, map, nnoremap, inoremap, etc?

like image 400
fcuk112 Avatar asked Sep 17 '09 10:09

fcuk112


People also ask

How do you toggle NERDTree?

Save the changes, open Vim, and then toggle NERDTree with Ctrl + n .

How do you switch between tabs in NERDTree?

Ctrl + → arrow will switch to tab that is on the right of current tab.

How do I show hidden files in NERDTree?

Press I ( Shift + i ) to toggle hidden files in the NERDTree explorer window. For more detail, access the NERDTree help file :help NERD_tree. txt and search for "hidden". And to hide hidden files by default, put let NERDTreeShowHidden=0 into your vimrc.


1 Answers

to remap in normal mode use

nmap <silent> <C-D> :NERDTreeToggle<CR>

nmap means map in normal mode
imap means map in insert mode

the nore part in nnoremap and its friends prevent expanding the mapping recursively. For example, i use to also hide search string so, in my vimrc I have

nnoremap <silent> <C-L> :noh<CR><C-L>

Without the nore, the above mapping will loop.

like image 144
Ayman Avatar answered Sep 28 '22 12:09

Ayman