VIM: tips & tricks
i - enter interactive mode (ESC quit interactive mode or jj)
v - enter visual mode
: - enter command mode
a - insert after cursor
o - insert line after current line
O - insert line before current line
dd - delete (and copy) current line
x - delete char under the cursor
p - paste
hjkl - left down up right
u - undo last change
c-R - redo last change
U - return last line which was modified to its original state
c-e - scroll window down
c-y - scroll window up
c-f - scroll down one page
c-b - scroll up one page
H - move cursor to the top of the window
M - move cursor to the middle of the window
L - move cursor to the bottom of the window
gg - go to top of file
G - go to bottom of file
w - go to the beginning of next word
e - go to end of the next word
b - go to beginning of previous word
w - words
s - sentences
p - paragraphs
t - tags
a - all
i - in
t - `til
f - find forward
F - find backward
d - delete
c - change (delete, then place in insert mode)
y - yank (copy)
v - visually select
# combination of command
diw - delete in word (will delete word under cursor)
caw - change all word (delete word and enter insert mode)
cw - change from cursor to end of word
di[ - delete inside []
da[ - delete content of [] with brackets itself
dt, - delete til comma
df, - delete til comma including comma
va' - visually select inside single quotes including quotes
. - repeats last motion (ie. ci' will delete inside single quotes and put into insert mode, then you can repeat that anywhere else with dot)
dd / yy - delete/yank the current line
D / C - delete/change until end of line
^ / $ - move to beginning / end of line
I / A - move to beginning / end of line and insert
o / O - insert line below / above and insert
p / P - paste below / above the line
:earlier 2m - go to the current file 2 minutes ago ;)
V - highlight whole line under the cursor
# record macros
q{recorder} - start recording
// do your things
q - stop recording
@{recorder} - replay macro
# setting marker
m{marker} - set marker
~{marker} - jump to marker
_