Editing
- i : insert
- I : insert at beginning of line
- a : append
- A : append at end of line
- dd : delete current line
- x : delete character
- r : replace current character
- R : replace mode
- s : substitute character and insert
Copy / Paste
- i : insert
- I : insert at beginning of line
- yy : copy the current line
- [number]yy : copy [number] lines
- yG : copy from cursor to end of file
- yW : copy from cursor to end of word
- y$ : copy from cursor to end of line
- P : paste above cursor
- p : paste below cursor
Saving and Quitting
- :w : save current file
- :x : save and quit current file (same as ZZ)
- :q! : quit without saving
Line numbers
- :set number/kbd> : show line numbers
- :set nonumber : hide line numbers
Substitutions
- :%s/^V^M//g : removes line breaks from file.
For ^V press ctrl-V and for ^M press ctrl-M
Navigating your file
- g : end of file
- 1g : beginning of file
- $ : end of line
- 0 : beginning of line
- : + [number] : goto line [number]
Folding
- zo : opens the fold
- zf : creates the fold
- zc : closes the fold