bab
bab

Reputation: 2169

Vim tab mapping not working

In my vimrc I have tab mapped to % in visual mode, normal mode, and I think command mode with

:map <tab> %
"colon necessary

so that when I hit tab it acts as %. Everything works fine except that when in visual mode if I hit tab instead of jumping to the matching pair it just deletes whatever was visually selected. In normal and command mode this doesn't happen.

Even if I use

vmap <tab> %

in my vimrc it still doesn't work. But when I set it manually while editing a file with

:vmap <tab> %

then tab acts as % like it should.

I have supertab and snipmate btw. But even if the problem is with the plugins I don't understand why manually setting tab works when setting it in my vimrc doesn't.

Upvotes: 1

Views: 1565

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172748

If you've determined that overriding the default mapping doesn't do harm to the way you use the other plugin (snipMate in your case; and I think the % mapping is not a core one, just to avoid some corner cases potentially breaking it), you can either comment out the original mapping (~/.vim/after/plugin/SnipMate.vim, in your case), or (recommended, because it leaves the original plugin intact):

Create a file ~/.vim/after/plugin/zzzmappings.vim and put your vmap mapping there. The .../after/ as well as the zzz prefix part ensures that this is sourced last, and therefore overrides everything defined before. (Your .vimrc, in contrast, is sourced before any plugin.)

Upvotes: 2

Related Questions