VIM: mapping for visual line mode
Asked Answered
S

1

9

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)?

Spirelet answered 16/7, 2014 at 14:4 Comment(1)
Alternativly, I would use '>....' instead of '>>>>'Squalid
J
17

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.

Jordan answered 16/7, 2014 at 14:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.