Copy N lines

N = 1:  Y
N = 2:  2Y
N = 10: 10Y
Till the end: yG

Cut

V (line) + d (cut) + p|P (paste)

Paste

Before: P
After: p

Delete

Till the beginning: dgg
Till the end: dG
From line 3 till 7: :3,7d
From line 3 till current line: 3,.d
From current position till '#' character (not inclusive): dt#
From current position till '#' character (inclusive): df#

Search

Case sensitive (default):
    /word
Case insensitive:
    :set ic    # Undo with :set noic
    /word
Go to the n-th occurrence:
    /word
    100n

Hexadecimal

Edit: :%!xxd
Exit: :%!xxd -r

Repeat N times character x

Esc + N + i + x

Replace

:%s/pat1/pat2/g     Replace pat1 with pat2 in all file
:s/pat1/pat2        Replace pat1 with pat2 in this line
:%s/</\r</g         Example: Replace '<' with '\r<' (new line + <)

Insert

Before: Ctrl + V -> Shift + i -> Insert character
After:  Ctrl + V -> Shift + a -> Insert character

Go to character

:goto 617

Go to line

:20     Go to line 20

Format XML:

:'<,'>!xmllint --format -   Reindents the previously selected block of code

Delete ^M characters:

:%s/[Ctrl+V][Ctrl+M]//g

Show line numbers:

:set number

Open a file in a line:

_$: vi +123 /path/to/file