mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
63
sources_non_forked/vim-go/ftplugin/go.vim
Normal file
63
sources_non_forked/vim-go/ftplugin/go.vim
Normal file
@ -0,0 +1,63 @@
|
||||
" Copyright 2013 The Go Authors. All rights reserved.
|
||||
" Use of this source code is governed by a BSD-style
|
||||
" license that can be found in the LICENSE file.
|
||||
"
|
||||
" go.vim: Vim filetype plugin for Go.
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
if !exists("g:go_auto_type_info")
|
||||
let g:go_auto_type_info = 0
|
||||
endif
|
||||
|
||||
setlocal formatoptions-=t
|
||||
|
||||
setlocal comments=s1:/*,mb:*,ex:*/,://
|
||||
setlocal commentstring=//\ %s
|
||||
|
||||
setlocal noexpandtab
|
||||
|
||||
compiler go
|
||||
|
||||
if !exists("g:go_doc_keywordprg_enabled")
|
||||
let g:go_doc_keywordprg_enabled = 1
|
||||
endif
|
||||
if g:go_doc_keywordprg_enabled
|
||||
" keywordprg doesn't allow to use vim commands, override it
|
||||
nnoremap <buffer> <silent> K :GoDoc<cr>
|
||||
endif
|
||||
|
||||
|
||||
if !exists("g:go_def_mapping_enabled")
|
||||
let g:go_def_mapping_enabled = 1
|
||||
endif
|
||||
if g:go_def_mapping_enabled
|
||||
nnoremap <buffer> <silent> gd :GoDef<cr>
|
||||
endif
|
||||
|
||||
|
||||
let b:undo_ftplugin = "setl fo< com< cms<"
|
||||
|
||||
" Set gocode completion
|
||||
setlocal omnifunc=go#complete#Complete
|
||||
|
||||
" GoInfo automatic update
|
||||
if g:go_auto_type_info != 0
|
||||
setlocal updatetime=300
|
||||
au! CursorHold *.go nested call go#complete#Info()
|
||||
endif
|
||||
|
||||
|
||||
" autoload settings
|
||||
if !exists('g:go_fmt_autosave')
|
||||
let g:go_fmt_autosave = 1
|
||||
endif
|
||||
|
||||
if g:go_fmt_autosave
|
||||
autocmd BufWritePre <buffer> call go#fmt#Format(-1)
|
||||
endif
|
||||
|
||||
" vim:ts=4:sw=4:et
|
92
sources_non_forked/vim-go/ftplugin/go/commands.vim
Normal file
92
sources_non_forked/vim-go/ftplugin/go/commands.vim
Normal file
@ -0,0 +1,92 @@
|
||||
if exists("g:go_loaded_commands")
|
||||
finish
|
||||
endif
|
||||
let g:go_loaded_commands = 1
|
||||
|
||||
|
||||
" Some handy plug mappings
|
||||
nnoremap <silent> <Plug>(go-run) :<C-u>call go#cmd#Run(expand('%'))<CR>
|
||||
nnoremap <silent> <Plug>(go-build) :<C-u>call go#cmd#Build('')<CR>
|
||||
nnoremap <silent> <Plug>(go-install) :<C-u>call go#cmd#Install()<CR>
|
||||
nnoremap <silent> <Plug>(go-test) :<C-u>call go#cmd#Test('')<CR>
|
||||
nnoremap <silent> <Plug>(go-coverage) :<C-u>call go#cmd#Coverage('')<CR>
|
||||
nnoremap <silent> <Plug>(go-vet) :<C-u>call go#cmd#Vet()<CR>
|
||||
nnoremap <silent> <Plug>(go-files) :<C-u>call go#tool#Files()<CR>
|
||||
nnoremap <silent> <Plug>(go-deps) :<C-u>call go#tool#Deps()<CR>
|
||||
nnoremap <silent> <Plug>(go-info) :<C-u>call go#complete#Info()<CR>
|
||||
nnoremap <silent> <Plug>(go-import) :<C-u>call go#import#SwitchImport(1, '', expand('<cword>'))<CR>
|
||||
|
||||
nnoremap <silent> <Plug>(go-implements) :<C-u>call go#oracle#Implements(-1)<CR>
|
||||
|
||||
nnoremap <silent> <Plug>(go-rename) :<C-u>call go#rename#Rename()<CR>
|
||||
|
||||
nnoremap <silent> <Plug>(go-def) :<C-u>call go#def#Jump()<CR>
|
||||
nnoremap <silent> <Plug>(go-def-vertical) :<C-u>call go#def#JumpMode("vsplit")<CR>
|
||||
nnoremap <silent> <Plug>(go-def-split) :<C-u>call go#def#JumpMode("split")<CR>
|
||||
nnoremap <silent> <Plug>(go-def-tab) :<C-u>call go#def#JumpMode("tab")<CR>
|
||||
|
||||
nnoremap <silent> <Plug>(go-doc) :<C-u>call go#doc#Open("leftabove new")<CR>
|
||||
nnoremap <silent> <Plug>(go-doc-tab) :<C-u>call go#doc#Open("tabnew")<CR>
|
||||
nnoremap <silent> <Plug>(go-doc-vertical) :<C-u>call go#doc#Open("vnew")<CR>
|
||||
nnoremap <silent> <Plug>(go-doc-split) :<C-u>call go#doc#Open("split")<CR>
|
||||
nnoremap <silent> <Plug>(go-doc-browser) :<C-u>call go#doc#OpenBrowser()<CR>
|
||||
|
||||
|
||||
" gorename
|
||||
command! -nargs=? GoRename call go#rename#Rename(<f-args>)
|
||||
|
||||
" oracle
|
||||
command! -range=% GoImplements call go#oracle#Implements(<count>)
|
||||
|
||||
" tool
|
||||
command! -nargs=0 GoFiles echo go#tool#Files()
|
||||
command! -nargs=0 GoDeps echo go#tool#Deps()
|
||||
command! -nargs=* GoInfo call go#complete#Info()
|
||||
|
||||
" cmd
|
||||
command! -nargs=* -bang GoRun call go#cmd#Run(<bang>0,<f-args>)
|
||||
command! -nargs=? -bang GoBuild call go#cmd#Build(<bang>0)
|
||||
command! -nargs=* GoInstall call go#cmd#Install(<f-args>)
|
||||
command! -nargs=* GoTest call go#cmd#Test(<f-args>)
|
||||
command! -nargs=* GoCoverage call go#cmd#Coverage(<f-args>)
|
||||
command! -nargs=0 GoVet call go#cmd#Vet()
|
||||
|
||||
" -- play
|
||||
command! -nargs=0 -range=% GoPlay call go#play#Share(<count>, <line1>, <line2>)
|
||||
|
||||
" -- def
|
||||
command! -nargs=* -range GoDef :call go#def#Jump(<f-args>)
|
||||
|
||||
" -- doc
|
||||
command! -nargs=* -range -complete=customlist,go#package#Complete GoDoc call go#doc#Open('leftabove new', <f-args>)
|
||||
command! -nargs=* -range -complete=customlist,go#package#Complete GoDocBrowser call go#doc#OpenBrowser(<f-args>)
|
||||
|
||||
" -- fmt
|
||||
command! -nargs=0 GoFmt call go#fmt#Format(-1)
|
||||
command! -nargs=0 GoImports call go#fmt#Format(1)
|
||||
|
||||
" -- import
|
||||
command! -nargs=? -complete=customlist,go#package#Complete GoDrop call go#import#SwitchImport(0, '', <f-args>)
|
||||
command! -nargs=1 -complete=customlist,go#package#Complete GoImport call go#import#SwitchImport(1, '', <f-args>)
|
||||
command! -nargs=* -complete=customlist,go#package#Complete GoImportAs call go#import#SwitchImport(1, <f-args>)
|
||||
|
||||
" -- lint
|
||||
command! GoLint call go#lint#Run()
|
||||
|
||||
" -- errcheck
|
||||
command! GoErrCheck call go#errcheck#Run()
|
||||
|
||||
" Disable all commands until they are fully integrated.
|
||||
"
|
||||
" command! -range=% GoOracleDescribe call go#oracle#Describe(<count>)
|
||||
" command! -range=% GoOracleCallees call go#oracle#Callees(<count>)
|
||||
" command! -range=% GoOracleCallers call go#oracle#Callers(<count>)
|
||||
" command! -range=% GoOracleCallgraph call go#oracle#Callgraph(<count>)
|
||||
" command! -range=% GoOracleCallstack call go#oracle#Callstack(<count>)
|
||||
" command! -range=% GoOracleFreevars call go#oracle#Freevars(<count>)
|
||||
" command! -range=% GoOraclePeers call go#oracle#Peers(<count>)
|
||||
" command! -range=% GoOracleReferrers call go#oracle#Referrers(<count>)
|
||||
|
||||
" vim:ts=4:sw=4:et
|
||||
"
|
||||
|
36
sources_non_forked/vim-go/ftplugin/go/snippets.vim
Normal file
36
sources_non_forked/vim-go/ftplugin/go/snippets.vim
Normal file
@ -0,0 +1,36 @@
|
||||
if exists("g:go_loaded_gosnippets")
|
||||
finish
|
||||
endif
|
||||
let g:go_loaded_gosnippets = 1
|
||||
|
||||
" by default UltiSnips
|
||||
if !exists("g:go_snippet_engine")
|
||||
let g:go_snippet_engine = "ultisnips"
|
||||
endif
|
||||
|
||||
function! s:GoUltiSnips()
|
||||
if globpath(&rtp, 'plugin/UltiSnips.vim') == ""
|
||||
return
|
||||
endif
|
||||
|
||||
if !exists("g:UltiSnipsSnippetDirectories")
|
||||
let g:UltiSnipsSnippetDirectories = ["gosnippets/UltiSnips"]
|
||||
else
|
||||
let g:UltiSnipsSnippetDirectories += ["gosnippets/UltiSnips"]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:GoNeosnippet()
|
||||
if globpath(&rtp, 'plugin/neosnippet.vim') == ""
|
||||
return
|
||||
endif
|
||||
|
||||
let g:neosnippet#enable_snipmate_compatibility = 1
|
||||
exec 'NeoSnippetSource' globpath(&rtp, 'gosnippets/snippets/go.snip')
|
||||
endfunction
|
||||
|
||||
if g:go_snippet_engine == "ultisnips"
|
||||
call s:GoUltiSnips()
|
||||
elseif g:go_snippet_engine == "neosnippet"
|
||||
call s:GoNeosnippet()
|
||||
endif
|
55
sources_non_forked/vim-go/ftplugin/go/tagbar.vim
Normal file
55
sources_non_forked/vim-go/ftplugin/go/tagbar.vim
Normal file
@ -0,0 +1,55 @@
|
||||
" Check if tagbar is installed under plugins or is directly under rtp
|
||||
" this covers pathgen + Vundle/Bundle
|
||||
"
|
||||
" Also make sure the ctags command exists
|
||||
"
|
||||
if !executable('ctags')
|
||||
finish
|
||||
elseif globpath(&rtp, 'plugin/tagbar.vim') == ""
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("g:go_gotags_bin")
|
||||
let g:go_gotags_bin = "gotags"
|
||||
endif
|
||||
|
||||
|
||||
function! s:SetTagbar()
|
||||
let bin_path = go#tool#BinPath(g:go_gotags_bin)
|
||||
if empty(bin_path)
|
||||
return
|
||||
endif
|
||||
|
||||
if !exists("g:tagbar_type_go")
|
||||
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' : expand(bin_path),
|
||||
\ 'ctagsargs' : '-sort -silent'
|
||||
\ }
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
call s:SetTagbar()
|
Reference in New Issue
Block a user