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