Skip to content

Instantly share code, notes, and snippets.

@vgangireddyin
Last active May 30, 2016 12:35
Show Gist options
  • Save vgangireddyin/69ed6aa879fa493b1285a4cc0c3b9739 to your computer and use it in GitHub Desktop.
Save vgangireddyin/69ed6aa879fa493b1285a4cc0c3b9739 to your computer and use it in GitHub Desktop.
My Vim Setup for GoLang
--langdef=Go
--langmap=Go:.go
--regex-Go=/func([ \t]+\([^)]+\))?[ \t]+([a-zA-Z0-9_]+)/\2/f,func/
--regex-Go=/var[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/v,var/
--regex-Go=/type[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/t,type/
#!/bin/bash
#purge current settings
apt-get -y remove --purge vim vim-runtime vim-gnome vim-tiny vim-common vim-gui-common
#install tools need to build vim from scratch
apt-get -y build-dep vim-gnome liblua5.1-dev luajit libluajit-5.1 python-dev ruby-dev libperl-dev libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev make
#remove traces of vim
rm -rf /usr/local/share/vim
rm /usr/bin/vim
#lua option setuo
mkdir /usr/include/lua5.1/include
mv /usr/include/lua5.1/*.h /usr/include/lua5.1/include/
ln -s /usr/bin/luajit-2.0.0-beta9 /usr/bin/luajit
#move to specific loacation
cd ~
git clone https://github.com/vim/vim
cd vim/src
make distclean
./configure --with-features=huge \
--enable-rubyinterp \
--enable-largefile \
--disable-netbeans \
--enable-pythoninterp \
--with-python-config-dir=/usr/lib/python2.7/config \
--enable-perlinterp \
--enable-luainterp \
--with-luajit \
--enable-gui=auto \
--enable-fail-if-missing \
--with-lua-prefix=/usr/include/lua5.1 \
--enable-cscope
make
make install
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplete.
let g:neocomplete#enable_at_startup = 1
" Use smartcase.
let g:neocomplete#enable_smart_case = 1
" Set minimum syntax keyword length.
let g:neocomplete#sources#syntax#min_keyword_length = 3
" Plugin key-mappings.
inoremap <expr><C-g> neocomplete#undo_completion()
inoremap <expr><C-l> neocomplete#complete_common_string()
" Recommended key-mappings.
" <CR>: close popup and save indent.
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return neocomplete#close_popup() . "\<CR>"
endfunction
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <C-h>, <BS>: close popup and delete backword char.
inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><C-y> neocomplete#close_popup()
inoremap <expr><C-e> neocomplete#cancel_popup()
" Go related mappings
au FileType go nmap <Leader>i <Plug>(go-info)
au FileType go nmap <Leader>gd <Plug>(go-doc)
au FileType go nmap <Leader>r <Plug>(go-run)
au FileType go nmap <Leader>b <Plug>(go-build)
au FileType go nmap <Leader>t <Plug>(go-test)
au FileType go nmap gd <Plug>(go-def-tab)
nmap <F8> :TagbarToggle<CR>
colorscheme peaksea
set completeopt-=preview
set number
#!/bin/bash
#####################
#### Build Vim ######
#####################
#install basic one
git clone git://github.com/cridenour/vimrc.git ~/.vim_runtime
sh ~/.vim_runtime/install_awesome_vimrc.sh
#install things for tagbar
apt-get -y install ctags exuberant-ctags
#install tagbar using pathogen
git clone git://github.com/majutsushi/tagbar $HOME/.vim_runtime/sources_non_forked/tagbar
#copy my configs for vim
wget --quiet https://gist.githubusercontent.com/venugangireddy/69ed6aa879fa493b1285a4cc0c3b9739/raw/9c8cb72b4ac1c53c1ea09f9a965ec7572ec1773a/my_configs.vim -O $HOME/.vim_runtime/my_configs.vim
#copy ctags
wget --quiet https://gist.githubusercontent.com/venugangireddy/69ed6aa879fa493b1285a4cc0c3b9739/raw/9c8cb72b4ac1c53c1ea09f9a965ec7572ec1773a/.ctags -O $HOME/.ctags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment