20160202

vim

Great VIM tutorials:
http://derekwyatt.org/vim/tutorials/

Movement (:h motion.txt)

0, $ - begging and end of line

w, W - beginning of word
e, E - end of word
b, B - beginning of word (backwards)
ge, gE - end of word (backwards)

f, F - next character in line (cap for backwards)
t, T - till next character in line (cap for backwards)
; - repeat last character search in line

C-u, C-d - half page scroll (up, down)
gg - beginning of file
G - end of file
H - top visible line
M - middle visible line
L - lower visible line

* - search current full word (n - next, N - previous)
# - search current full word backwards  (n - next, N - previous)
g* - search current word anywhere
g# - search current word anywhere

/ - search (regex, etc)
? - search backwards

]] - next opening brace
[[ - prev opening brace
% - matching brace (or tags with matchit.vim)

----
i - insert
I - insert in beggining of line
a - append (after current character)
A - append at end of line
o - insert new line
O -  insert new line above
x - delete one char
X - delete one char reverse
d - delete (combine with motions, dw - delete word from current char, diw - delete inside word)
D - delete until end of line
c - change (delete and put in insert mode, combine with motions e.g. ciw to change inside word)
C - change until end of line
r - replace one char
R - replace mode
. - repeat last action
y - yank
Y - yank line
p - put
P - put before
J - join line
gJ - join without spaces
v - visual mode
V - visual line mode
Ctrl-V - visual block mode
gv - reselect previous visual selection

----
Buffers
:ls - list buffers
:b2 - open buffern #2
:bp - previous buffer
Ctrl-6 - previous buffer

----
CtrlP (ctags)
:!ctags -R = generate tags file (.gitignore it)
Ctrl-] - jump to defintion
Ctrl-t -jump to previous tage
:tag sometag - look for tag
:tn, :tp, :ts - tag next, prev and list
----
Ctrl-e in insert mode to expand css style html (with sparkup plugin)