How to remap a NERDTree shortcut in VIM

gvimkey-bindingkeymapvim

I use the Dvorak keyboard layout with VIM, and the 't' key is the 'up' motion when editing a regular file.

The problem is that NERDTree remaps 't' to open files in a new tab. How can I undo that mapping and use 't' for the up motion in NERDTree?

Here are the relevant lines from my vimrc file and from the NERDTree plugin.

My .vimrc:

no t k

NERDTree plugin file:

exec "nnoremap <silent> <buffer> ". g:NERDTreeMapOpenInTab ." :call <SID>openInNewTab(0)<cr>"

call s:initVariable("g:NERDTreeMapOpenInTab", "t")

let @h=@h."\" ". g:NERDTreeMapOpenInTab.": open in new tab\n"

Best Answer

The documentation for NERDTree shows that you can change the mapping letter for most, if not all of the mappings. For example, ":help NERDTree-t" shows this:

Default key: t
Map option: NERDTreeMapOpenInTab
Applies to: files and directories.

So in your vimrc you can put something like this to change it from "t" to "\t":

let NERDTreeMapOpenInTab='\t'

Then NERDTree will stop overriding your preferred functinality of the "t" key in normal mode.

Related Question