I use vim at work, but we have an IT guy who installed a bunch of magical plugins for vim on my work laptop so that now when I try to open vim on my home laptop, I am completely lost because I don't have any shortcuts or key mappings.
I just installed NerdTree. I don't want to have to type :NERDTree everytime I want to open it. How would I map "Ctrl + g" to open and close NERDTree? Where would I do this?
1 Answer
Mappings work just like a recorded sequence of keys (as the right-hand side). As this is Vim, you need to be aware of the modes; here, normal mode, so n:
:nnoremap <C-g> :NERDTree<CR>This maps (without remapping, the nore... part) to <C-g> (see :help key-notation) the :NERDTree command, concluded by Enter.
To have this permanently, put the line into your user's ~/.vimrc.