1. Modes
Command mode – ctrl + [ or just tap ESC few times
Visual mode – v – allow to select
Visual Block mode – column mode. ESC to apply changes
Insert mode – i, a – normal typing
Replace mode – R (capital r)

2.  Opening a file, new file
vim <file name> – open a file or create new if doesnt exist
vim <file name> +<line number> – open a file at given line
:e <file name> – open a file from within vim (e from edit)
:e %:h/<filename> – open a file from within vim from different dir

3. closing and saving file
:w – save changes
:q! – force quit no save
ZZ – save and quit

4. moving around
h,j,k,l – left, top, down, right
w – move word forward in line
<number>w – move <number> words forward in line
b – move word backward in line
<number>b – move <number> words backward in line
gg – move to start of a file
:<number> or
<number>G – jump to line <number>
0 – jump to start of line
^ – move to first non-white character in line
$ – jump to end of line
% – match nearest bracket [] () {}
f<character> – jump to character in line: fa – jump to next ‘a’
:jumps – show all views; <number> +ctrl + o to jump where want
ctrl + o – jump to previous place
ctrl + i – jump to next view

5. edit
i – start edit at cursor place (insert)
I – start edit at line start
a – start edit after current character (append)
A – start edit at the end of line
r – replace single character (R – replacement mode)
J – remove \n from end of line (join two lines to one)
u – undo
ctrl + r – redo
:u1|u – undo all changes
:edit! – go back to last save version of the file (:w)
:dd – delete line
:dw – delete word
:d<number>w – delete 3 words forward or backward with b
:x – delete character forward or backward with X
:c – change. :cw – change word, :ciw – change inner word
:C – change until end o line

6. copy/paste
d – cut
y – copy selected (yank)
yw or yb- copy word forward or backward
yiw – copy whole word where cursor is (inside word)
y<number>w – copy <number> words forward or backward with b
y^ – copy from cursor to start of line
y$ – copy from cursor to end of line
p – paste

7. view
:sp or :split – horizontally split window; one buffer with two windows. Ctrl-w + and Ctrl-w – change size
:vsp or :vsplit – vertically split window. Ctrl-w > and Ctrl-< – change size
ctrl+w <h/j/k/l> – move between windows
ctrl+w i – clone window and open in split
:resize <number> or :res <number>- resize height of window to number of lines
:vertical resize <number> – change width of current window
:ctr-w = – go back to default split sizes
ctrl + w + h/j/k/l – move between windows
zz – move view to cursor
zb – move view to top of cursor position
zt – move view to bottom of cursor position
ctrl + E oe ctrl + Y – move view down/up a line (cursor stay in place)

8. search
\<word> – search for worf
:noh – cancel search highlight
* – search word at cursor position
n – go to next found item
N- go to previous found item
:set hlsearch – highlight all finding (a must)
:s/<word1>/<word2>/<flags> – substitute. more

9. misc
. – redo last command
:make – call make
:!<bash command> – minimize vim and execute <bash command>:example: :!cl main.c or :!grep <word> -n -H
:set number – show line numbers
<start line number>GV<end line number>G – select range between lines