Vim Cheat Sheet
Vim Cheat Sheet
I have then
given a few instructions on how to make Vim as great as it should be, because it’s
painful without configuration.
Essentials
Cursor movement (Normal/Visual Mode)
* h j k l - Arrow keys
* w / b - Next/previous word
* W / B - Next/previous word (space seperated)
* e / ge - Next/previous end of word
* 0 / $ - Start/End of line
* ^ - First non-blank character of line (same as 0w)
Editing text
Operators
Clipboard
Exiting
General
* u - Undo
* Ctrl+r - Redo
Advanced
Cursor movement
Character search
Editing text
Visual mode
File Tabs
Marks
* Marks allow you to jump to designated points in your code.
* m{a-z} - Set mark {a-z} at cursor position
* A capital mark {A-Z} sets a global mark and will work between files
* '{a-z} - Move the cursor to the start of the line where the mark was set
* '' - Go back to the previous jump location
Text Objects
* Say you have def (arg1, arg2, arg3), where your cursor is somewhere in the
middle of the parenthesis.
di( deletes everything between the parenthesis. That says “change everything
inside the nearest parenthesis”. Without text objects, you would need to do T(dt).
Learn more
General