VIM Cheatsheet
14 days agoSearch and replace current file (same for Visual replacement)
%s/foo/bar/gi
Jump beginning or end of line and start insert
Beginning: I
End: A
Jump beginning or end of file
Beginning: gg
End: G
Redo
ctrl+^
Words
dw - delete word
b - jump word - beginning
e - jump word - end
Full screen navigation
gg - move cursor to first line
#G - move cursor to # line
GG move cursor to last line
CTRL+f - move cursor Forward full page
CTRL+b - move cursor Backwards full page
CTRL+u - move cursor Up half page
CTRL+d - move cursor Down half page
zt - move screen so cursor is at Top
zb - move screen so cursor is at Bottom
zz - center screen on cursor (very useful!)
ZZ - save document and quit (be careful!)
Multi Line Editing
Another approach is to use the . (dot
) command in combination with i.
- Move the cursor where you want to start
- Press i
- Type in the prefix you want (e.g.
vendor_
) - Press esc.
- Press j to go down a line
- Type . to repeat the last edit, automatically inserting the prefix again
- Alternate quickly between j and .
Lazyvim
NerdTree - Create file
a
Jump to function
gd
Toggle Formatter
<leader>uf
