Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VIM: mapping for visual line mode

Tags:

vim

mappings

I have this mappings for indenting several lines by pressing TAB in visual mode:

vnoremap <Tab> >gv
vnoremap <S-Tab> <gv

But it conflicts with snipmate plugin. Is there a way to remap TAB button to work only in visual line mode (S-V)?

like image 749
Anton Avatar asked Jul 16 '14 14:07

Anton


1 Answers

Change your mapping commands from vnoremap to xnoremap:

xnoremap <Tab> >gv
xnoremap <S-Tab> <gv

Why?

v[nore]map defines mappings both for visual mode and for select mode. Because Snipmate puts you into select mode when you are on a placeholder you need to use a more specific mapping command that can't be triggered in select mode: x[nore]map.

Actually, you should always use x[nore]map instead of v[nore]map.

like image 79
romainl Avatar answered Sep 22 '22 23:09

romainl