Tutorial by Examples

CommandDescription<Esc>Leaves insert mode, triggers autocommands and abbreviations<C-[>Exact synonymous of <Esc><C-c>Leaves insert mode, doesn't trigger autocommands Some people like to use a relatively uncommon pair of characters like jk as shortcut for <Esc> or <C...
CommandDescriptionaAppend text following current cursor positionAAppend text at the end of current lineiInsert text before the current cursor positionIInsert text before first non-blank character of current linegIInsert text in first column of cursor linegiInsert text at same position where it was l...
CommandDescription<C-w>Delete word before cursor<C-t>Indent current line with by one shiftwidth<C-d>Unindent current line with by one shiftwidth<C-f>reindent the line, (move cursor to auto indent position)<C-a>Insert previously inserted text<C-e>Insert the charact...
While in insert mode, press <C-o> to temporarily leave insert mode and execute a one-off normal command. Example <C-o>2w jumps to the second word to the left and returns to insert mode. Note: Repeating with . will only repeat the actions from returning to insert mode This allows for ...
Press Ctrl + v to enter into visual block mode. Use ↑ / ↓ / j / k to select multiple lines. Press Shift + i and start typing what you want. After you press Esc, the text will be inserted into all the lines you selected. Remember that Ctrl+c is not 100% equivalent to Esc and will not work in this...
If you use the paste command from your terminal emulator program, Vim will interpret the stream of characters as if they were typed. That will cause all kind of undesirable effects, particularly bad indendation. To fix that, from command mode: :set paste Then move on to insert mode, with i, for...
While in insert mode, you can use <C-r> to paste from a register, which is specified by the next keystroke. <C-r>" for example pastes from the unnamed (") register. See :help registers.
Here is a quick reference for advanced insertion, formatting, and filtering commands/shortcuts. Command/ShortcutResultg + ? + mPerform rot13 encoding, on movement mn + ctrl + a+n to number under cursorn + ctrl + x-n to number under cursorg + q+ mFormat lines of movement m to fixed width:rce wCenter...
When pasting text through a terminal emulator, the auto-indent feature may destroy the indentation of the pasted text. For example: function () { echo 'foo' echo 'bar' echo 'baz' } will be pasted as: function () { echo 'foo' echo 'bar' echo 'baz' ...

Page 1 of 1