vim tipps

show all visible characters like spaces, tabs, line breaks / hide all visible characters

set list
set nolist

Enable / Disable syntax highlighting

syntax on
syntax off

Enabling current row and column highlighting

set cursorline
set cursorcolumn

Enabling relative line numbering (cursor is always at zero)

set relativenumber

Indentation in vi

you want to mark something in visual mode, and indent the selected part several times to the left or the right?
First, you add these lines to your .vimrc

vnoremap < <gv
vnoremap > >gv

Now you can visually select a text passage (press v move the arrow keys), afterward, indent it to the left by pressing < or indent it to the right by pressing >

Shortkeys

fe           go to next letter "e" in the current line
Fe           go to pevious letter "e" in current line
;            go to next occurence of what you found with t/T/f/F
:h f         show the vim internal help for f
3Y           copy three lines (from the line where the cursor is located)

Search and replace

search and replace all foo with bar (% = in all lines, s=substitute)
:%s/foo/bar/g

search and replace all foo with bar (c = ask for confirmation before)
:%s/foo/bar/gc

list the number of the occurence of searchterm
:%s/searchstring//gn

search and replace from line 10 to 25 all 123 (^ = standing at beginning of line) with aaa
:10,25 s/^123/aaa/g

my/old with my/new. To avoid masking specialcharacters use: s:my/old:my/new/g
:% s/my\/old/my\/new/g

remove all leading spaces in all lines
%le

delete everithing before the pattern http
:s/^.*\(FOO\)/\1/

Merking, Copy and paste

*             highlight all words, like that under the cursor
V             visually mark the whole current line
viw           visually mark word under cursor 
p             paste what has been copied before
4p            paste what has been copied before 4 times
yy            copy whole line where the cursor is
yiw           copy word under cursor
yi"           copy text between ". This works analog for yi(, yi[, yi{, yi', yi<
ya"           copy text between ", including the ". This works analog for yi(, yi[, yi{, yi', yi<

Inserting Text

a                              append rigt to the cursor
A                              Append right to the line
i                              insert left to the cursor
I                              insert to beginning of line
s                              substitute character
S                              substitute line
o                              insert line below cursor
O                              insert line above cursor

Sorting and manipulating the contents structure

:sort       sort all lines alphabetically
:sort u     sort all lines alphabetically and remove duplicates
ggVGu       lowercase whole Text

Moving the cursor

gg                 to the beginning of the document
G                  to the end of the document
$                  to the end of the line
^                  to the beginning of the line
h                  left (one character)
l                  right (one character)
j                  one line down
k                  one line up
4k                 four lines up
13G                instantly to line 13
w                  to beginning of next word
e                  to end of next word
b                  to beginning of previous word
3w                 to the beginning of the next third word

Deleting

x                  character right to the cursor
X                  character left to the cursor
diw                the current word where the cursor is over
dd                 the current line (where the cursor is)
ggdG               the whole document (you can also use :%d)
3dd                the next three lines (incl. the cursors line)
dgg                all lines from the cursor to the documents beginning
dG                 all Lines from the cursor to the documents end
dw                 from cursor to end of word
d3w                from cursor the next three words (incl. the word where curser is over)
di"                inside "", you can also use di' di( di{ di[ to delete inside
dit                inside tags. Delete all content inside two matching tags like <b> blabla</b>
dtX                from cursor to next X (excluding X)
dfX                from cursor to next X (including X)
dTX                from cursor to previous X (excluding X)
dFX                from cursor to previous X (including X)
cit                delete inside tags and write immediately something