💾 Archived View for rawtext.club › ~bird › library › vim-cheatsheet.gmi captured on 2023-01-29 at 04:10:02. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-05)
-=-=-=-=-=-=-
$ vim # start vim
$ vim myfile.txt # edit named file - creates it if it doesn't exist
$ vim - # read and edit text from STDIN - use with pipe commands, eg:
$ ls -l | vim -
$ vimtutor # learn vim
$ vim -h # basic help
$ man vim # read the manual page for vim
u - undo
Ctrl-r - redo
U - redo changes to last line
ZZ - Save and exit
ZQ - Discard changes and exit
:w - Save (write)
:w myfile.txt - write file with given filename - use to rename or if editing an unnamed buffer
h - cursor left
l - cursor right
j - cursor down
k - cursor up
w - cursor to start of next word
b - cursor to start of previous word
o - insert blank line below cursor and go into INSERT mode
O - insert blank line above cursor and go into INSERT mode
dw - delete word under cursor
x - delete character under cursor
dd - cut line
2dd - cut 2 lines
V - select a group of lines then d to cut
p - paste lines below cursor
P - paste lines above cursor