I don't know what the default vim behavior is for Tab when in visual selection mode, but it's nice to have VS's default of having the selection be indented on tab and unindented on shift+tab (at least when set vsvim_useeditordefaults is in my vimrc file).
Thanks for reporting!
The current behavior of Visual Mode is by design. Both Tab and Shift+tab do nothing by default in Visual Mode. If you would like to get behavior that is similar to Visual Studio then what you can do is creating a binding for those keys in Visual Mode that do the shift / unshift operations
:vmap <Tab> >>
:vmap <Shift+Tab> <<
If you put these entries in your _vimrc file, or just run them inside VsVim, then Tab and Shift+Tab will have the behavior you expect.
Note: The vsvim_useeditordefaults setting doesn't refer to commands. Instead it refers to whether VsVim should choose vim or VS defaults for values like tabstop and shiftwidth.
Ah, good to know. Thanks for the workaround and the fantastic product!
I should point out that the command needs to be :vmap <S-Tab> <<, not Shift+Tab.
@pckujawa doh! Yes. That is correct.
This was my first hit in Google for "vsvim shift tab insert mode", so here is what worked for me for insert mode (not visual mode):
:inoremap <S-Tab> <C-d>
p.s. Thanks for the awesome plugin!
I know this is a closed issue but just wanted to put out that when hitting tab in visual mode it then removes the visual mode selection so you have to reselect to do move more than one tab. Is there a way around this?
Edit: it actually puts the cursor in an odd sort of insert (override) state.
Edit 2: Also doesn't seem to respect visual studios tab function where it takes off centered tab content and re-aligns it to a tab boundary.
To restore Selection after Tab/Shift Tab you can use following bindings:
vmap <Tab> >gv
vmap <S-Tab> <gv
This fixes the losing selection issue, thanks. Since this is the first hit in google, here is what I put in my .vsvimrc file to persist between loads...
:vmap <Tab> >>
:vmap <S-Tab> <<
:inoremap <S-Tab> <C-d>
:vmap <Tab> >gv
:vmap <S-Tab> <gv
You don't need the first two lines in your .vsvimrc file. Lines 3 and 4 overwrites it.
I don't know if it works with : at begin. I have following lines in my .vsvimrc
" Un-\Ident in Normal mode with Shift\Tab
nnoremap <Tab> >>
nnoremap <S-Tab> <<
" Un-\Ident in Insert mode with Shift\Tab
inoremap <Tab> <C-t>
inoremap <S-Tab> <C-d>
" Un-\Ident in Visual mode with Shift\Tab
vnoremap <Tab> >gv
vnoremap <S-Tab> <gv
and it works almost perfect 馃槃
Ah, wasn't sure if they were some how chained together or not. I'm still fairly new to vim. It does work with the : at the front though.
After putting the code that idealist1508 mentioned, it seems to have disabled the Tab Autocompletion thats built into Visual Studio. It just indents the line instead of inserting a tab
Most helpful comment
You don't need the first two lines in your .vsvimrc file. Lines 3 and 4 overwrites it.
I don't know if it works with
:at begin. I have following lines in my .vsvimrcand it works almost perfect 馃槃