Filetype specific options

e.g. no line numbers for markdown

au FileType markdown set nonumber 

Copy all

:%y+

Yank all text

Spellcheck

:set spell spelllang=en_gb

]s move to the next mispelled word
[s move to the previous mispelled word
zg add a word to the dictionary
zug undo the addition of a word to the dictionary
z= view spelling suggestions for a mispelled word

Visual block mode to add to start or append to end of lines

Append to the end of all lines

vip<C-V>$A,<Esc>

Explanation: In normal mode, Visual select a paragraph vip, switch to Visual block mode Ctrl-V, append to all lines $A a comma ,.

Using I inserts at the start of the line.

Search and replace globally

:%s/x/y/g

Replaces x with y

Tabs and open files

:tabedit {file}
:tabclose
:tabonly

gt switch to next tab
gT switch to previous tab

Move between open files with

:prev  
:next  

Changing colour scheme

:colorscheme elflord

changes the colourscheme to elflord

/ is search forward
? is search back
n is find next in the same direction
N is find next in the opposite direction

* find next instance of word under cursor
# find previous instance of word under cursor
Ctrl-o takes you back

Apend etc

ea is append end of word
ciw change inner word (i.e. delete word and go into insert mode)

Paste into a new line

Put

:nmap <leader>p o<ESC>p

into your vimrc and use that

Underling headings in markdown

yypVr-

From http://vim.wikia.com/wiki/Underline_using_dashes_automatically

Typewritter scroll mode

See https://randomdeterminism.wordpress.com/2011/08/15/typewriter-scroll-mode-in-vim/

Unite plugin

http://bling.github.io/blog/2013/06/02/unite-dot-vim-the-plugin-you-didnt-know-you-need/

Removing ^M in text files

http://its.ucsc.edu/unix-timeshare/tutorials/clean-ctrl-m.html

Add in further line-breaks to those that already exist in markdown

:%s/ \n/\0 \r/g

Swap two characters

xp

:noh

Interactively replace

:%s/old/new/gc

Removing Ctrl-M

There are quite a few ways of doing this, but a quick way to remove ^M scattered around your file is as follows:

:%s/C-vC-m//g

Where C-v is Ctrl-v and C-m is Ctrl-m.

From http://dailyvim.blogspot.co.uk/2009/01/removing-ctrl-m.html