Professional Documents
Culture Documents
change replace
copy
Cheat Sheet yank
f
is
lu
uz
put paste
delete cut
^r Ctrl + r
Cursor movement
h j k l
Editing
r - replace single character under the cursor s - delete character and substitute text
R - replace multiple characters SS - delete line and substitute text (same as cc)
Inserting / Appending
i - insert before the cursor o - open a blank line below the cursor
I - insert at the beginning of the line O - open a blank line above the cursor
Visual commands
> - shift text right y - yank (copy) marked text
Exiting
:w - write the file but don't exit :! - execute external command (e.g. :!date)
:w !sudo tee % - write current file with sudo :wq or :x - write changes and quit
:w fname - write the file as fname but don't exit q - quit (fails if any anything has changed)
:r fname - retrieve fname and put it below cursor Sq! - quit and discard any unsaved changes
I?pattern - search backward for pattern :s/old/new - replace first old with new in a line
n - repeat search in the same direction :s/old/new/g - replace all 'old's with new in the
whole line
N - repeat search in the opposite direction
:%s/old/new/g - replace all 'old's with new in the
^o - go back to older positions whole file
:%s/old/new/gc - replace all 'old's with new in the
^i - go forward to newer positions whole file with confirmations
Global
:help keyword - open help for keyword :saveas file - save as file
:o file - open file K - open man page for word under the cursor
Operators Motions
c - change w - until start of next word excluding its first character