Cheatography
https://cheatography.com
A cheatsheet for Vim motions.
FIND AND REPLACE
|
Replace whole file |
|
Whole word |
:[range]s/{pattern}/{replacement}/{flags}
Range
(empty) |
Current line |
|
Entire file |
|
Current line to end of file |
|
Line 10 to line 20 |
• ,
== "to"
• .
== "current line"
• $
== "end of file"
Flags
|
Replace all occurrences in given range |
|
Ask for confirmation |
|
Ignore case |
|
Case sensitive |
|
Print count only, does not make any changes |
Macros
|
Record to register {register}
|
|
Stop recording |
|
Play macro |
Macros are a motion, which means doing 5j@a
is valid
|
|
VERTICAL MOVEMENT
|
Down 1 line |
|
Up 1 line |
|
Down 10 lines |
|
Up 10 lines |
Screen/Page Movement
|
Half-page down |
|
Half-page up |
|
Go to top of the current screen (High) |
|
Go to bottom of the current screen (Low) |
|
Go to middle of the current screen (Middle) |
{ |
Jump to the previous paragraph/block |
} |
Jump to the next paragraph/block |
These matter for covering distance fast
Insertion
|
Insert at start of line |
|
|
|
New line below |
|
New line above |
Large-Scale Movement
|
Go to first line (top of file) |
|
Go to last line (bottom of file) |
|
Go to line 123 |
|
|
HORIZONTAL MOVEMENT
|
Move left 1 character |
|
Move right 1 character |
|
Start of next word |
|
Start of previous word (Back) |
|
End of current/next word |
WORD Movement
|
Next WORD |
|
Previous WORD |
|
End of WORD |
some_var=value
, path/to/file
, foo(bar)
are all WORDS
Precision Movement
|
Go to column 0 (absolute start of line) |
|
Go to first non-blank of line |
|
Go to end of line |
|
Move to the next occurrence of <char>
|
|
Move to the previous occurrence of <char>
|
|
Move before the next occurrence |
|
Move before the previous occurrence. |
Operators
|
Delete |
|
Change (delete + insert) |
|
Yank (copy) |
|
Flip case |
|
To lowercase |
|
To uppercase |
|
|
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets