How do I create a macro that converts lines to a numbered list?
qa I1. <Esc>j q
This simple macro inserts a list number prefix at the beginning of each line.
qa I1. <Esc>j q
This simple macro inserts a list number prefix at the beginning of each line.
<C-v>u{code} in insert mode
In insert mode, u followed by a 4-digit hex code inserts the Unicode character at that code point.
]p
The ]p command pastes text and adjusts its indentation to match the current line.
ciw + new text + Esc, then n.
The ciw command followed by new text, combined with and .
ci`
The ` ci ` command changes the text inside backtick delimiters.
V select then :norm A text
Selecting lines and running :norm A text appends the same text to the end of every selected line.
cs"' (change), ds" (delete), ys iw" (add)
The vim-surround plugin by Tim Pope adds commands for working with surrounding characters like quotes, brackets, and tags.
Plug 'tpope/vim-repeat'
vim-repeat by Tim Pope extends the .
:%S/old/new/g (vim-abolish)
vim-abolish by Tim Pope provides :%S (Subvert), a substitute command that preserves the case pattern of the original text.
gcc (toggle line), gc{motion} (toggle range)
vim-commentary by Tim Pope provides a simple way to toggle comments.
let mapleader = " "
The leader key is a prefix for custom mappings.
:diffthis in both windows
The :diffthis command enables diff mode for the current buffer.
"+y and "+p
The "+ register is linked to the system clipboard.
"1p through "9p
Registers 1-9 contain the last 9 deletions or changes that are at least one line long.
".
The .
Use :let i=1 with macro
By combining a Vimscript variable with a macro, you can create sequences with incrementing numbers.
"=2+3<CR>p
The expression register = evaluates a Vimscript expression and stores the result.
"ap, edit, "add
Since macros are stored in registers, you can paste the register content into the buffer, edit it, and yank it back.
U (in visual mode)
In visual mode, pressing U converts all selected text to uppercase.
y (in visual mode)
In visual mode, pressing y yanks (copies) the selected text into the default register.