Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Map F2 to NEERDTreeToggle

Tags:

vim

nerdtree

I want just to open and close NERDTree, pushing the F2 button. I've mapped it in this way :

map <silent>  <F2> NERDTreeToggle 

But, Actually this doesn't work properly and I haven't understood why...

like image 346
Giuseppe Pes Avatar asked Apr 24 '12 18:04

Giuseppe Pes


2 Answers

Here is my config for NERDTree.

silent! nmap <C-p> :NERDTreeToggle<CR>
silent! map <F3> :NERDTreeFind<CR>

let g:NERDTreeMapActivateNode="<F3>"
let g:NERDTreeMapPreview="<F4>"

F3 will open NERDTree panel and highlight current file. And when you're in the NERDTree panel, F3 will open file under cursor. So, I can use one button to jump between buffer and NERDTree. (And F4 for preview because it's next to F3)

like image 51
cutalion Avatar answered Oct 16 '22 03:10

cutalion


your mapping:

map <silent> <F2> NERDTreeToggle

should be:

map <F2> :NERDTreeToggle<CR>

I think you'll find that'll work (you basically missed the colon and the <CR> to make the action happen...

like image 21
phildobbin Avatar answered Oct 16 '22 02:10

phildobbin