Insert mode edit mappings
A common trait among Vim power-users is that they aim to enter and exit insert mode as little as possible. They use normal-mode navigation and make judicious use of the dot command to repeat, improving edit efficiency. Of course, insert mode is essential for actual insertion and once you’re in it, you should know about a number of mappings that will help you stay in insert mode. By staying in insert mode and completing your entire edit without exiting, you can build up edits that are repeatable.
Here are several mappings that work while insert mode. Perhaps some of these might be new to you, or at least helpful for reinforcement:
ctrl-h
– Delete previous character (same as backspace)ctrl-w
– Delete previous wordctrl-u
– Delete entire line (except any indent)ctrl-t
– Indent the current linectrl-d
– Backdent the current line
There’s a brief screencast of each of these below. Note the particular utility of indenting or backdenting the current line while already in insert mode. If you’re trying to build a repeatable command that inserts text and indents it, ctrl-t
will do the trick.