This website is built by coding on vim.

There is a steep learning curve for vim.

However, once you are killed at it, you can code fast with ease.


Vim Cheetsheet

Show vim default key bindings

:help index 

Vim plugins

10 Must have vim plugins


Vundle Vim plugin manager

First, install a vim plugin manager. I use Vundle.


YouCompletMe A powerful auto completion plugin, especially for C-familty support.

How to map the YCM fixit key?

The following code in `.vimrc’ would map the FixIt command to , f where my leader key is ,

let mapleader=","
map <leader>f :YcmCompleter FixIt<CR>

Use YVM to jump to definition

Use , j d to jump to definition.

nnoremap <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR>

My .ycm_extra_conf.py (MAC OSX)

Without corrent settings, it cannot find the standard library and perform auto completion. (e.g. unordered_map)

flags = [
    '-Wall',
    '-std=c++11',
    '-stdlib=libc++',
    '-x',
    'c++',
    '-I',
    '.',
    '-isystem',
    '/Library/Developer/CommandLineTools/usr/include/c++/v1'
]

UltiSnipt.vim


emmet.vim A plugin to expanding abbreviation like emmet for web development. (HTML/CSS)

1. First install it using Vundle. Put the following line in your .vimrc.

Plugin 'mattn/emmet-vim'

and in vim, type shift + : in command mode input:

: BundleInstall

Vundle will install the plugins for you automatically.

If you want to have custom code snippets, you need to install webapi as well.

Plugin 'mattn/webapi-vim'

2. Let’s use it.

The default expand key is ctrl + y + ,.

Below is the animation from official site:

animation

You can change the expand key by put the following line in your .vimrc.

The following code maps the expand key to ctrl + e

let g:user_emmet_expandabbr_key = '<c-e>'

Reference


Selected Q & A for vim

1. What syntax file is being used?

:echo b:current_syntax

Original question @ superuser


2. How to swap between two split windows?

ctrl + w + r


3. Key map in vim

http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-_Tutorial_(Part_2)

4. Solution for YouCompleteMe conflicts with UltiSnipts

https://github.com/Valloric/YouCompleteMe/issues/420#issuecomment-55940039
https://github.com/SirVer/ultisnips/issues/512

5. List the script activated

http://vim.wikia.com/wiki/List_loaded_scripts