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"
link|improve this question

feedback

2 Answers

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

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

So you can put in your vimrc 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.

link|improve this answer
feedback

Hope this helps,

au vimenter * map t k

put this in your vimrc file

link|improve this answer
doh! Tried it, and it didn't work. Thanks though. – btelles Apr 5 '10 at 13:20
I've edited the line. This should work. – asdfg Apr 5 '10 at 13:32
Oh bumcicles....still no dice. – btelles Apr 5 '10 at 13:42
This is working for me. There could be some other mapping. Better change that "t" in NERDTree to something you dont use.. – asdfg Apr 5 '10 at 14:53
The reason this is not working is that NERDTree defines the "t" mapping as a buffer-local mapping on-the-fly every time a NERDTree window is opened, thus overriding any previously defined "t" mapping. See my answer on how to solve this problem. – Heptite Oct 10 '10 at 19:30
show 1 more comment
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.