Skip to content

Instantly share code, notes, and snippets.

@liul85
Created September 21, 2017 14:53
Show Gist options
  • Save liul85/61268c13bf46ee6493824879d8f89198 to your computer and use it in GitHub Desktop.
Save liul85/61268c13bf46ee6493824879d8f89198 to your computer and use it in GitHub Desktop.
spf13-vim + vim-go
  1. Install spf13-vim
sh <(curl https://j.mp/spf13-vim3 -L)
  1. Install Go bundle
echo "let g:spf13_bundle_groups=['general', 'neocomplete', 'programming', 'ruby', 'python', 'go', 'javascript', 'html', 'misc', 'writing' ]" >> ~/.vimrc.before.local 
vim +BundleInstall! +qall
  1. Config .vimrc.local
" Customize
let g:indent_guides_enable_on_vim_startup = 0

" Use neocomplete
let g:neocomplete#enable_at_startup = 1
" Use smartcase.
let g:neocomplete#enable_smart_case = 1
" <TAB>: completion
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"

" Theme
let g:solarized_termtrans=0
let g:solarized_contrast="normal"
let g:solarized_visibility="normal"
set background=light
colorscheme solarized

" vim-go
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
" :GoDef
au Filetype go nmap gd <Plug>(go-def)

" tagbar
nmap <F8> :TagbarToggle<CR>
" ctags
let g:tagbar_type_go = {
    \ 'ctagstype' : 'go',
    \ 'kinds'     : [
        \ 'p:package',
        \ 'i:imports:1',
        \ 'c:constants',
        \ 'v:variables',
        \ 't:types',
        \ 'n:interfaces',
        \ 'w:fields',
        \ 'e:embedded',
        \ 'm:methods',
        \ 'r:constructor',
        \ 'f:functions'
    \ ],
    \ 'sro' : '.',
    \ 'kind2scope' : {
        \ 't' : 'ctype',
        \ 'n' : 'ntype'
    \ },
    \ 'scope2kind' : {
        \ 'ctype' : 't',
        \ 'ntype' : 'n'
    \ },
    \ 'ctagsbin'  : 'gotags',
    \ 'ctagsargs' : '-sort -silent'
\ }

" nerdtree
map <C-n> :NERDTreeToggle<CR>
  1. Remove annoying indent highlight
:set nolist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment