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>