Vim

" Insert text in the end of each line
" s/ - substitute.
" $ - the end of the line.
" / - change it to.
" , - a comma.
:%s/$/,
" Lowercase line
Vu
" Find char backwards
F<char>
" Delete backwards until char
dT<char>
" Visually select until char
v/<char><return>
" Delete all lines in file
:%d
" Yank two inner words
" Yanks first and second words (with the trailing space) in the unnamed register
y2aw
" Delete until start of line
d0
" Yank entire file
:%y+
" Select entire block
Vat
" Visually select until end of line
v$
" Visually select paragraph or function
V}
" See whats in a buffer
" See insides of q buffer
:echo @q
" See registers
:registers
" Delete until end of file
VGx
" Visually select block
V%
" Start recording macro
" Record to register d
qd
" Delete char under cursor
x
" Yank inside tag. Can yank an XML tag for example
yat
" Make multi line search. https://vim.fandom.com/wiki/Search_across_multiple_lines
" Will carry over to new line
\_s
" Inclusive search
/foo/e
" Delete until searched string. Won't delete string itself.
d/string
" Search and replace
:%s/<search>/<replace>/g
" Run command on startup
" Run ':Goyo' on startup. Put it in .vimrc
autocmd VimEnter * Goyo"
" Insert text at start of each line in file
" Insert // at start of each line in file
:%s!^!//!
" Replay last macro
@@
" Delete until character
df<char>
" Centre current line
zz
" Put results of command into a register
" In normal mode, will put results of d$ command into _ (black hole register)
"_d$
" Run macro on whole file
:%normal @x " will run macro x

Last updated