Warm tip: This article is reproduced from stackoverflow.com, please click
vim

Map shift-tab in vim to inverse tab in Vim

发布于 2020-06-19 11:01:08

I've done some searching and found a wealth of information on binding keys in vim, but I can't find out, for sure, how to map shift-tab. Or what command I need to map it to for it to "tab backwards".

This is what I have at the moment:

map <S-tab> <S-,><S-,>

Possibly Relevant Information: I'm running Debian with Terminal 2.22.3. with VIM - Vi IMproved 7.1

Questioner
newUser
Viewed
52
amphetamachine 2015-05-22 02:05

Vim already has built-in key commands for insert mode to shift the current line left or right one &shiftwidth. They are (in insert mode):

Ctrl-t : shift right (mnemonic "tab")

Ctrl-d : shift left (mnemonic "de-tab")

If you still want to use shift-tab, this is how you do it:

" for command mode
nnoremap <S-Tab> <<
" for insert mode
inoremap <S-Tab> <C-d>