vim-config/after/ftplugin/go.vim
2018-05-26 19:18:09 +02:00

68 lines
1.4 KiB
VimL

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'
\ }
let g:go_auto_type_info = 0
" mappings
noremap <C-B> :TagbarToggle<CR>
inoremap <C-B> <C-O>:TagbarToggle<CR>
nmap <F3> :GoInfo<CR>
function! MakePublic()
let l:wordUnderCursor = expand('<cword>')
let l:upperCaseWord = substitute(l:wordUnderCursor, '[A-Za-z]', '\\U&', '')
execute 'GoRename ' l:upperCaseWord
endfunction
nmap <F6> :GoDocBrowser<CR><CR>
nmap <F7> :GoDoc<CR>
nmap <F8> :call MakePublic()<CR><CR>
" ALE
" let g:ale_linters = {'go':['gofmt', "go build"], 'c':['clang']}
let g:ale_linters = {'go':['go build', 'gometalinter', 'gofmt'], 'c':['clang']}
let g:ale_fixers = {
\ 'go': ['gofmt', 'goimports'],
\ 'c': ['clang-format'],
\ 'cpp': ['clang-format'],
\ 'js': ['eslint'],
\ 'python': ['yapf'],
\}
let g:ale_go_gobuild_options = "-gcflags='-e'"
let g:ale_go_gometalinter_options = '--fast'
" vim-go
let g:go_highlight_functions = 1
let g:go_highlight_space_tab_error = 1
let g:go_highlight_chan_whitespace_error = 1