Selection
# select text inline
v
# select whole line (linewise visual mode)
V
# select current word as whole
vaw
# Select from current position to the end of the word
ve
# Select from current position to the beginning of the word
vb
# Select whole file content
ggVG
Text Wrapping
# wrap text in vim
:set wrap linebreak
# unwrap text in vim
:set wrap!
Save Edits
# write current edit to the file (save)
:w
# write then close file after
:wq
# exit file without writing (discard)
:q!
Abandon Edit
# Abandon existing buffer and reload the file you are editing (works like reset file)
:e!
# Force exit vim (similar to abandon)
:cq
Enter Insert/Edit Mode
# enter insert mode, can edit file content
i
# switch back to the command mode from insert mode
esc
Undo/Redo
# Undo last action
u
# Redo last undo
ctrl + r
Copy/Cut/Paste
# Copy selection
y
# Cut selection
d
# Paste selection (in line)
p
# Paste selection (line above)
P
Delete lines
# Delete current line while in command mode
dd
# Delete current line without overriding yank
_dd
# Delete 3 lines while in command mode (n-number of lines)
3dd
Swap Lines
# Swap current line with line above
ddkP
# Swap current line with line below
ddp
Indentation
# Indent selection (tab) in visual mode
>>
# Unindent (shift + tab) in visual mode
<<