Advanced vim tips

I always wanted to provide some vim tips for advanced vim users. I always feared the feedback, but I think I should do it now.

Use the leader!

Oh my god! Use it! You will get so much faster when using the leader on a regular basis. Of course you have to map it to your mostly used actions, but it can be such an performance win!

Here goes mine. Note that my leader is mapped to my space key:

let mapleader = "<Space>"
map <Leader&>w :w&<CR&>
map <Leader&>q :q
nnoremap <Leader><Leader> za
onoremap <Leader><Leader> <C-C>za
vnoremap <Leader><Leader> zf
map <Leader>sc :SyntasticCheck<CR>
map <Leader>nt :NERDTreeToggle %:p:h<CR>
map <Leader>tb :TagbarToggle<CR>
map <Leader>ut :UndotreeToggle<CR>
map <Leader>vr :VimroomToggle<CR>
map <Leader>ig <Plug>IndentGuidesToggle
map <Leader>ga :Git add %:p<CR><CR>
map <Leader>gs :Gstatus&<CR>
map <Leader>gc :Gcommit -v -q<CR>
map <Leader>gd :Gdiff<CR>
map <Leader>gb :Gblame<CR>
map <Leader>gp :!git push<space>
map <Leader>m :Make<CR>
map <Leader>h <C-w>h
map <Leader>j <C-w>j
map <Leader>k <C-w>k
map <Leader>l <C-w>l
map <Leader>s <C-w>s
map <Leader>v <C-w>v

You can find these mappings in my vimrc at github as well. Use it!

Don’t use the arrow keys!

This is very critical for your speed when using vim. Never, ever use the arrow keys!

map <UP>    <NOP>
map <DOWN>  <NOP>
map <LEFT>  <NOP>
map <RIGHT> <NOP>

You will get faster by lightyears!

This were two tips which are very critical when talking about speed when using vim. I don’t know whether these match your idea of ‘advanced vim tips’, but they are very important to me. I got a performance increase by around 50% just by using hjkl instead of the arrow keys as well as I got faster by the same amount with the leader mappings.

Use them. Tell me what you think.

GPG: 20CA0F94