Before I start, just remember, when in doubt just don't close vim and you'll live.
Exiting Vim
It's easier said than done for some, there's countless articles asking for help, here's a shortcut:
Intent: Write and Quit
If you intend to write and quit (save changes, exit), you should follow this key bindings:
- ESCAPE
- :
- wq
- ENTER
Intent: Write, but don't quit
If you intend to write and don't quit, simply run:
- ESCAPE
- :
- w
- ENTER
Editing content
You can either use the i
key, or hit insert
to write content in vim. If you hit r
or double hit insert
, it will open the replace mode.
Undo, anyone?
In order to undo, make sure you're not in write mode (hit escape), and hit the U
key until satisfied.
Can I redo it?
Yep, r
until satisfied.
How the heck can I fix the indentation?
A little opinionated, but if you run this command then hit F7, it'll format your code in an opinionated way:
- ESCAPE
- :map mzgg=G`z
- ENTER
- [KEY:F7]
That's all for now!
This should get you by using vim in it's most basic format!
Hum,
r
does not redo last undone change. I believe you meantCtrl-R
or:redo
(r
in normal mode would allow you to replace the char under the cursor with the char you'll type).