These day take long time to configure my vim environment, finally make my vim like IDE.
Share my experience here. First, this is my .vimrc
Normally I use it developing golang, bash, python and perl, with autocomplet plugin NeoComplete.
If you are vim fan, please compile vim by yourself, I don’t like install from repo, except MacVim. This is my compile conf ./configure --prefix=/usr/local --with-features=huge --enable-luainterp --enable-pythoninterp --enable-rubyinterp --with-luajit --enable-tclinterp --enable-rubyinterp --enable-perlinterp --enable-fail-if-missing
Binary would installed in /usr/local/bin/vim with most feature, have lua, python, perl, ruby, tcl and will reminder you if failed import some library. You must have lua for NeoComplete (https://github.com/Shougo/neocomplete.vim).
List all plugin I use :
pathogen.vim // most important plugin, you can easy install and remove plugin
tagbar // must have plugin, give you all tag in your file
ctrlp.vim // load file to buffer, you can quick switch edit file
emmet-vim // quick http generator
jellybeans.vim // colorscheme I use now
neocomplete.vim // auto complete when you typing
neosnippet.vim // auto complete language snippet when you typing
setcolors // vim script quick switch colors, I think it just for fun after you decide color. http://vim.wikia.com/wiki/Switch_color_schemes
syntastic // check syntax when you save file
tabular // aligning text, actually not necessary for golang
vim-colors-solarized // one popular color
vim-easymotion // cursor move tool, I map it to ctrl+j
vim-markdown // markdown syntax and you able to generator html by md format
vim-puppet // puppet syntax
vim-snippets // snippet library
Finally organize my conf’s key mapping
space – toggle folding
F2 – toggle paste mode or normal mode
F4 – toggle tagbar
ctrl+a – copy all (terminal mode)
ctrl+c – copy to system clipboard(terminal mode)
ctrl+v – paste from system clipboard(terminal mode)
cmd+a,c,v – same, but in MacVim’s gui mode
ctrl+j – quick jump
tab or ctrl+k – toggle snippet
F7 – markdown format to html format(need Markdown.pl)
\c – toggle comment
some special setting just for golang
install gotags and gocode, use go tags instead of ctags in golang, gocode is go snippet tool.
this line will help you auto format your go code when you save.
Related to header
I used to use these like control header
autocmd bufnewfile *.c so ~/.vim/headers/c.hd
autocmd bufnewfile *.go so ~/.vim/headers/go.hd
autocmd bufnewfile *.* exe “1,” . 10 . “g/File Name :.*/s//File Name : ” .expand(“%”)
autocmd bufnewfile *.* exe “1,” . 10 . “g/Creation Date :.*/s//Creation Date : ” .strftime(“%m-%d-%Y”)
Bad thing is if you have too much header, you are not able to add each time.
Finally I use current code with a header generator bash script, you only need send argument for filename and author, It could auto generate header file.
this is bash script
It still not perfect, cause each time first line will be empty line, but now it’s easy control.
Finally if you need download my vim env, you can download from kiyor.com/vim.tar.gz It already include ctags source code.