A list of Vim commands that I find useful.
r [enter]
J
>> and <<
Indentation is set by shiftwidth, the default is 8 spaces
Select code block in visual mode then
za # Fold / unfold text at cursor position
zM # Fold all foldable code
zR # unfold all foldable code
:mkview # Save fold information before saving file
:loadview # Load fold information after loading file
:ab linux GNU/Linux # When 'linux' is typed it will autocorrect to GNU/Linux
:ab # List all abbreviations
:unab linux # Remove 'linux' from abbreviations
:abc # Clear all abbreviations from memory
:sp # Split window horizontally
:vs # Split window vertically
CTRL+w < > # Change width of window
CTRL+w - + # Change height of window
CTRL+w H # Move active window to the Left of the screen
CTRL+w L # Move active window to the Right of the screen
CTRL+w J # Move active window to the Bottom of the screen
CTRL+w K # Move active window to the Top of the screen
:%!xxd # View file as hex editor
:%!xxd -r # Go back to normal mode before saving any changes
:w !wc -w
Select text in visual mode then
"+y
"+p
- CTRL + v top go into visual mode
- Highlight the lines you want to change
- SHIFT + i and type in the text you want
- ESC (then wait a second)
- Search for the word to change
/searchString
- press ENTER
cgn
- Stands for Change. Get the string. Next match
- Type in replacement word
- ESC
- Press . to change the next match
di"