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

Martin Tournoij
  • 62,054
  • 25
  • 192
  • 271
david
  • 23
  • 3
  • It's worth noting that is the same keycode as , 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 '15 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?. – Martin Tournoij Feb 24 '15 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 '15 at 19:16
  • @MattBoehm Yes, is the same keycode as.But it is strange that it work long time ago. – david Feb 24 '15 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 :-) – – Martin Tournoij Feb 24 '15 at 19:59
  • Could you clarify what you mean by "doesn't work"? Do you mean that nothing happens when you press [Tab]? – 200_success Feb 24 '15 at 20:40
  • Just a warning. Never use nmap. Always use nnoremap. If something else in your vimrc remaps v your nmap will pickup that mapped character and cause trouble. Read the end of http://learnvimscriptthehardway.stevelosh.com/chapters/05.html – John Oxley Nov 06 '15 at 16:59

1 Answers1

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.

Matt Boehm
  • 2,938
  • 16
  • 14
  • Thank you. I find the problem at the space.vim plugin.I new a issue to author.https://github.com/spiiph/vim-space/issues/26 – david Feb 25 '15 at 13:02