2

In my vimrc file, nmap <tab> v> doesn't work. But other key binding, such as

nmap <s-tab> v<
vmap <tab> >gv
vmap <s-tab> <gv

Do work.

I tried to search for <tab> in vimrc, and found just one:

nmap <tab> v>

This is my complete vimrc:

https://github.com/arcticlion/dotfile/blob/master/.vimrc
https://github.com/arcticlion/dotfile/blob/master/.vim/plugin.vim

7
  • It's worth noting that <tab> is the same keycode as <C-I>, so you will be overriding that functionality. Also, unless the right side of your mapping contains another mapping that you are sure you want to expand, you should use nnoremap or vnoremap instead
    – Matt Boehm
    Feb 24, 2015 at 19:07
  • 1
    You use: Plugin 'ervandew/supertab' in your vimrc ... I expect that probably changes some Tab key behaviour? Does it work when you use vimrc with no plugins or even no vimrc file? See: How do I debug my vimrc file?. Feb 24, 2015 at 19:11
  • 1
    Minor note, though I doubt this will fix the issue: To adjust indentation levels in Normal mode, I'd recommend using the Normal mode >> and << instead of entering Visual mode with v> and v<. Analogous to dd, >> and << operate on the current line.
    – tommcdo
    Feb 24, 2015 at 19:16
  • @MattBoehm Yes, <tab> is the same keycode as<C-I>.But it is strange that it work long time ago.
    – david
    Feb 24, 2015 at 19:35
  • 1
    @david That may be due to the fact that you have a rather large vimrc file with many plugins. If I try it, it seems to work. That's why I recommended the "How to debug my vimrc" link earlier :-) – Feb 24, 2015 at 19:59

1 Answer 1

2

Most likely, this is conflicting with some other mapping in your .vimrc or in a plugin.

After launching vim, see what <tab> is mapped to (and what last mapped it):

:verbose nmap <tab>

You should expect this to say something along the lines of:

n <tab>          * v>
        Last set from ~/.vimrc

In general when you suspect that a plugin/customization may be interfering with something, you should follow the steps outlined in the aforementioned "How do I debug my vimrc file?". When dealing specifically with mappings, the steps I outlined above are sometimes a quick shortcut to diagnosing the problem.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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