I want to make use of Shift+Tab to left-shift (unindent) a block of text, instead of Ctrl+d. How to do it?
The basics of simple mappings are explained in Vim's excellent user manual at
You want some key combination (Shift + Tab) to do what's already provided by Vim's Ctrl + D command, so you map
:help key-notation now) to
<C-d>. As Vim is a mode-based editor, you need to consider the mode;
:help i_CTRL-D is for insert mode.
As your target is a built-in Vim command, you should use
:noremap; it makes the mapping immune to remapping and recursion.
inoremap <S-Tab> <C-d>
To try this out, just execute the above command (entering command-line mode via
:, and concluding with Enter). To make this persist across Vim sessions, put it into your
~/.vimrc configuration, and restart Vim.
<C-d> command will still work; you've just created an alias. As you've defined an alternative, you could remap that key now, or (if it bothers you, if you frequently mistakenly trigger it) turn it off by mapping to the special
inoremap <C-d> <Nop>