mirror of
https://github.com/amix/vimrc
synced 2025-07-18 17:44:59 +08:00
merge
This commit is contained in:
19
sources_non_forked/vim-go/ftplugin/asm.vim
Normal file
19
sources_non_forked/vim-go/ftplugin/asm.vim
Normal file
@ -0,0 +1,19 @@
|
||||
" asm.vim: Vim filetype plugin for Go assembler.
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let b:undo_ftplugin = "setl fo< com< cms<"
|
||||
|
||||
setlocal formatoptions-=t
|
||||
|
||||
setlocal comments=s1:/*,mb:*,ex:*/,://
|
||||
setlocal commentstring=//\ %s
|
||||
|
||||
setlocal noexpandtab
|
||||
|
||||
command! -nargs=0 AsmFmt call go#asmfmt#Format()
|
||||
|
||||
" vim: sw=2 ts=2 et
|
@ -5,13 +5,11 @@
|
||||
" go.vim: Vim filetype plugin for Go.
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
if !exists("g:go_auto_type_info")
|
||||
let g:go_auto_type_info = 0
|
||||
endif
|
||||
let b:undo_ftplugin = "setl fo< com< cms<"
|
||||
|
||||
setlocal formatoptions-=t
|
||||
|
||||
@ -22,42 +20,112 @@ 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()
|
||||
if get(g:, "go_doc_keywordprg_enabled", 1)
|
||||
" keywordprg doesn't allow to use vim commands, override it
|
||||
nnoremap <buffer> <silent> K :GoDoc<cr>
|
||||
endif
|
||||
|
||||
|
||||
" autoload settings
|
||||
if !exists('g:go_fmt_autosave')
|
||||
let g:go_fmt_autosave = 1
|
||||
if get(g:, "go_def_mapping_enabled", 1)
|
||||
" these are default Vim mappings, we're overriding them to make them
|
||||
" useful again for Go source code
|
||||
nnoremap <buffer> <silent> gd :GoDef<cr>
|
||||
nnoremap <buffer> <silent> <C-]> :GoDef<cr>
|
||||
nnoremap <buffer> <silent> <C-w><C-]> :<C-u>call go#def#Jump("split")<CR>
|
||||
nnoremap <buffer> <silent> <C-w>] :<C-u>call go#def#Jump("split")<CR>
|
||||
nnoremap <buffer> <silent> <C-t> :<C-U>call go#def#StackPop(v:count1)<cr>
|
||||
endif
|
||||
|
||||
if g:go_fmt_autosave
|
||||
autocmd BufWritePre <buffer> call go#fmt#Format(-1)
|
||||
if get(g:, "go_textobj_enabled", 1)
|
||||
onoremap <buffer> <silent> af :<c-u>call go#textobj#Function('a')<cr>
|
||||
onoremap <buffer> <silent> if :<c-u>call go#textobj#Function('i')<cr>
|
||||
|
||||
xnoremap <buffer> <silent> af :<c-u>call go#textobj#Function('a')<cr>
|
||||
xnoremap <buffer> <silent> if :<c-u>call go#textobj#Function('i')<cr>
|
||||
|
||||
" Remap ]] and [[ to jump betweeen functions as they are useless in Go
|
||||
nnoremap <buffer> <silent> ]] :<c-u>call go#textobj#FunctionJump('n', 'next')<cr>
|
||||
nnoremap <buffer> <silent> [[ :<c-u>call go#textobj#FunctionJump('n', 'prev')<cr>
|
||||
|
||||
onoremap <buffer> <silent> ]] :<c-u>call go#textobj#FunctionJump('o', 'next')<cr>
|
||||
onoremap <buffer> <silent> [[ :<c-u>call go#textobj#FunctionJump('o', 'prev')<cr>
|
||||
|
||||
xnoremap <buffer> <silent> ]] :<c-u>call go#textobj#FunctionJump('v', 'next')<cr>
|
||||
xnoremap <buffer> <silent> [[ :<c-u>call go#textobj#FunctionJump('v', 'prev')<cr>
|
||||
endif
|
||||
|
||||
" vim:ts=4:sw=4:et
|
||||
if get(g:, "go_auto_type_info", 0) || get(g:, "go_auto_sameids", 0)
|
||||
let &l:updatetime= get(g:, "go_updatetime", 800)
|
||||
endif
|
||||
|
||||
" NOTE(arslan): experimental, disabled by default, doesn't work well. No
|
||||
" documentation as well. If anyone feels adventerous, enable the following and
|
||||
" try to search for Go identifiers ;)
|
||||
"
|
||||
" if get(g:, "go_sameid_search_enabled", 0)
|
||||
" autocmd FileType go nnoremap <buffer> <silent> * :<c-u>call Sameids_search(0)<CR>
|
||||
" autocmd FileType go nnoremap <buffer> <silent> # :<c-u>call Sameids_search(1)<CR>
|
||||
" autocmd FileType go nnoremap <buffer> <silent> n :<c-u>call Sameids_repeat(0)<CR>
|
||||
" autocmd FileType go nnoremap <buffer> <silent> N :<c-u>call Sameids_repeat(1)<CR>
|
||||
" autocmd FileType go cabbrev nohlsearch <C-r>=Sameids_nohlsearch()<CR>
|
||||
" endif
|
||||
|
||||
" " mode 0: next 1: prev
|
||||
" function! Sameids_repeat(mode)
|
||||
" let matches = getmatches()
|
||||
" if empty(matches)
|
||||
" return
|
||||
" endif
|
||||
" let cur_offset = go#util#OffsetCursor()
|
||||
|
||||
" " reverse list to make it easy to find the prev occurence
|
||||
" if a:mode
|
||||
" call reverse(matches)
|
||||
" endif
|
||||
|
||||
" for m in matches
|
||||
" if !has_key(m, "group")
|
||||
" return
|
||||
" endif
|
||||
|
||||
" if m.group != "goSameId"
|
||||
" return
|
||||
" endif
|
||||
|
||||
" let offset = go#util#Offset(m.pos1[0], m.pos1[1])
|
||||
|
||||
" if a:mode && cur_offset > offset
|
||||
" call cursor(m.pos1[0], m.pos1[1])
|
||||
" return
|
||||
" elseif !a:mode && cur_offset < offset
|
||||
" call cursor(m.pos1[0], m.pos1[1])
|
||||
" return
|
||||
" endif
|
||||
" endfor
|
||||
|
||||
" " reached start/end, jump to the end/start
|
||||
" let initial_match = matches[0]
|
||||
" if !has_key(initial_match, "group")
|
||||
" return
|
||||
" endif
|
||||
|
||||
" if initial_match.group != "goSameId"
|
||||
" return
|
||||
" endif
|
||||
|
||||
" call cursor(initial_match.pos1[0], initial_match.pos1[1])
|
||||
" endfunction
|
||||
|
||||
" function! Sameids_search(mode)
|
||||
" call go#guru#SameIds()
|
||||
" call Sameids_repeat(a:mode)
|
||||
" endfunction
|
||||
|
||||
" function! Sameids_nohlsearch()
|
||||
" call go#guru#ClearSameIds()
|
||||
" return "nohlsearch"
|
||||
" endfunction
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
@ -1,92 +1,95 @@
|
||||
if exists("g:go_loaded_commands")
|
||||
finish
|
||||
endif
|
||||
let g:go_loaded_commands = 1
|
||||
" -- gorename
|
||||
command! -nargs=? GoRename call go#rename#Rename(<bang>0,<f-args>)
|
||||
|
||||
" -- guru
|
||||
command! -nargs=* -complete=customlist,go#package#Complete GoGuruScope call go#guru#Scope(<f-args>)
|
||||
command! -range=% GoImplements call go#guru#Implements(<count>)
|
||||
command! -range=% GoWhicherrs call go#guru#Whicherrs(<count>)
|
||||
command! -range=% GoCallees call go#guru#Callees(<count>)
|
||||
command! -range=% GoDescribe call go#guru#Describe(<count>)
|
||||
command! -range=% GoCallers call go#guru#Callers(<count>)
|
||||
command! -range=% GoCallstack call go#guru#Callstack(<count>)
|
||||
command! -range=% GoFreevars call go#guru#Freevars(<count>)
|
||||
command! -range=% GoChannelPeers call go#guru#ChannelPeers(<count>)
|
||||
command! -range=% GoReferrers call go#guru#Referrers(<count>)
|
||||
|
||||
" 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>
|
||||
command! -range=0 GoSameIds call go#guru#SameIds()
|
||||
command! -range=0 GoSameIdsClear call go#guru#ClearSameIds()
|
||||
command! -range=0 GoSameIdsToggle call go#guru#ToggleSameIds()
|
||||
command! -range=0 GoSameIdsAutoToggle call go#guru#AutoToogleSameIds()
|
||||
|
||||
nnoremap <silent> <Plug>(go-implements) :<C-u>call go#oracle#Implements(-1)<CR>
|
||||
" -- tags
|
||||
command! -nargs=* -range GoAddTags call go#tags#Add(<line1>, <line2>, <count>, <f-args>)
|
||||
command! -nargs=* -range GoRemoveTags call go#tags#Remove(<line1>, <line2>, <count>, <f-args>)
|
||||
|
||||
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
|
||||
" -- tool
|
||||
command! -nargs=0 GoFiles echo go#tool#Files()
|
||||
command! -nargs=0 GoDeps echo go#tool#Deps()
|
||||
command! -nargs=* GoInfo call go#complete#Info()
|
||||
command! -nargs=* GoInfo call go#tool#Info(0)
|
||||
command! -nargs=0 GoAutoTypeInfoToggle call go#complete#ToggleAutoTypeInfo()
|
||||
|
||||
" 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()
|
||||
" -- cmd
|
||||
command! -nargs=* -bang GoBuild call go#cmd#Build(<bang>0,<f-args>)
|
||||
command! -nargs=? -bang GoBuildTags call go#cmd#BuildTags(<bang>0, <f-args>)
|
||||
command! -nargs=* -bang GoGenerate call go#cmd#Generate(<bang>0,<f-args>)
|
||||
command! -nargs=* -bang -complete=file GoRun call go#cmd#Run(<bang>0,<f-args>)
|
||||
command! -nargs=* -bang GoInstall call go#cmd#Install(<bang>0, <f-args>)
|
||||
command! -nargs=* -bang GoTest call go#cmd#Test(<bang>0, 0, <f-args>)
|
||||
command! -nargs=* -bang GoTestFunc call go#cmd#TestFunc(<bang>0, <f-args>)
|
||||
command! -nargs=* -bang GoTestCompile call go#cmd#Test(<bang>0, 1, <f-args>)
|
||||
|
||||
" -- cover
|
||||
command! -nargs=* -bang GoCoverage call go#coverage#Buffer(<bang>0, <f-args>)
|
||||
command! -nargs=* -bang GoCoverageClear call go#coverage#Clear()
|
||||
command! -nargs=* -bang GoCoverageToggle call go#coverage#BufferToggle(<bang>0, <f-args>)
|
||||
command! -nargs=* -bang GoCoverageBrowser call go#coverage#Browser(<bang>0, <f-args>)
|
||||
|
||||
" -- play
|
||||
command! -nargs=0 -range=% GoPlay call go#play#Share(<count>, <line1>, <line2>)
|
||||
|
||||
" -- def
|
||||
command! -nargs=* -range GoDef :call go#def#Jump(<f-args>)
|
||||
command! -nargs=* -range GoDef :call go#def#Jump('')
|
||||
command! -nargs=? GoDefPop :call go#def#StackPop(<f-args>)
|
||||
command! -nargs=? GoDefStack :call go#def#Stack(<f-args>)
|
||||
command! -nargs=? GoDefStackClear :call go#def#StackClear(<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 GoDoc call go#doc#Open('new', 'split', <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 GoFmtAutoSaveToggle call go#fmt#ToggleFmtAutoSave()
|
||||
command! -nargs=0 GoImports call go#fmt#Format(1)
|
||||
|
||||
" -- asmfmt
|
||||
command! -nargs=0 GoAsmFmtAutoSaveToggle call go#asmfmt#ToggleAsmFmtAutoSave()
|
||||
|
||||
" -- 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>)
|
||||
command! -nargs=? -complete=customlist,go#package#Complete GoDrop call go#import#SwitchImport(0, '', <f-args>, '')
|
||||
command! -nargs=1 -bang -complete=customlist,go#package#Complete GoImport call go#import#SwitchImport(1, '', <f-args>, '<bang>')
|
||||
command! -nargs=* -bang -complete=customlist,go#package#Complete GoImportAs call go#import#SwitchImport(1, <f-args>, '<bang>')
|
||||
|
||||
" -- lint
|
||||
command! GoLint call go#lint#Run()
|
||||
" -- linters
|
||||
command! -nargs=* GoMetaLinter call go#lint#Gometa(0, <f-args>)
|
||||
command! -nargs=0 GoMetaLinterAutoSaveToggle call go#lint#ToggleMetaLinterAutoSave()
|
||||
command! -nargs=* GoLint call go#lint#Golint(<f-args>)
|
||||
command! -nargs=* -bang GoVet call go#lint#Vet(<bang>0, <f-args>)
|
||||
command! -nargs=* -complete=customlist,go#package#Complete GoErrCheck call go#lint#Errcheck(<f-args>)
|
||||
|
||||
" -- errcheck
|
||||
command! GoErrCheck call go#errcheck#Run()
|
||||
" -- alternate
|
||||
command! -bang GoAlternate call go#alternate#Switch(<bang>0, '')
|
||||
|
||||
" 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>)
|
||||
" -- ctrlp
|
||||
if globpath(&rtp, 'plugin/ctrlp.vim') != ""
|
||||
command! -nargs=? -complete=file GoDecls call ctrlp#init(ctrlp#decls#cmd(0, <q-args>))
|
||||
command! -nargs=? -complete=dir GoDeclsDir call ctrlp#init(ctrlp#decls#cmd(1, <q-args>))
|
||||
endif
|
||||
|
||||
" vim:ts=4:sw=4:et
|
||||
"
|
||||
" -- impl
|
||||
command! -nargs=* -buffer -complete=customlist,go#impl#Complete GoImpl call go#impl#Impl(<f-args>)
|
||||
|
||||
" -- template
|
||||
command! -nargs=0 GoTemplateAutoCreateToggle call go#template#ToggleAutoCreate()
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
75
sources_non_forked/vim-go/ftplugin/go/mappings.vim
Normal file
75
sources_non_forked/vim-go/ftplugin/go/mappings.vim
Normal file
@ -0,0 +1,75 @@
|
||||
" go_jump_to_error defines whether we should pass the bang attribute to the
|
||||
" command or not. This is only used for mappings, because the user can't pass
|
||||
" the bang attribute to the plug mappings below. So instead of hardcoding it
|
||||
" as 0 (no '!' attribute) or 1 (with '!' attribute) we pass the user setting,
|
||||
" which by default is enabled. For commands the user has the ability to pass
|
||||
" the '!', such as :GoBuild or :GoBuild!
|
||||
if !exists("g:go_jump_to_error")
|
||||
let g:go_jump_to_error = 1
|
||||
endif
|
||||
|
||||
" Some handy plug mappings
|
||||
nnoremap <silent> <Plug>(go-run) :<C-u>call go#cmd#Run(!g:go_jump_to_error)<CR>
|
||||
|
||||
if has("nvim")
|
||||
nnoremap <silent> <Plug>(go-run-vertical) :<C-u>call go#cmd#RunTerm(!g:go_jump_to_error, 'vsplit', [])<CR>
|
||||
nnoremap <silent> <Plug>(go-run-split) :<C-u>call go#cmd#RunTerm(!g:go_jump_to_error, 'split', [])<CR>
|
||||
nnoremap <silent> <Plug>(go-run-tab) :<C-u>call go#cmd#RunTerm(!g:go_jump_to_error, 'tabe', [])<CR>
|
||||
endif
|
||||
|
||||
nnoremap <silent> <Plug>(go-build) :<C-u>call go#cmd#Build(!g:go_jump_to_error)<CR>
|
||||
nnoremap <silent> <Plug>(go-generate) :<C-u>call go#cmd#Generate(!g:go_jump_to_error)<CR>
|
||||
nnoremap <silent> <Plug>(go-install) :<C-u>call go#cmd#Install(!g:go_jump_to_error)<CR>
|
||||
nnoremap <silent> <Plug>(go-test) :<C-u>call go#cmd#Test(!g:go_jump_to_error, 0)<CR>
|
||||
nnoremap <silent> <Plug>(go-test-func) :<C-u>call go#cmd#TestFunc(!g:go_jump_to_error)<CR>
|
||||
nnoremap <silent> <Plug>(go-test-compile) :<C-u>call go#cmd#Test(!g:go_jump_to_error, 1)<CR>
|
||||
|
||||
nnoremap <silent> <Plug>(go-coverage) :<C-u>call go#coverage#Buffer(!g:go_jump_to_error)<CR>
|
||||
nnoremap <silent> <Plug>(go-coverage-clear) :<C-u>call go#coverage#Clear()<CR>
|
||||
nnoremap <silent> <Plug>(go-coverage-toggle) :<C-u>call go#coverage#BufferToggle(!g:go_jump_to_error)<CR>
|
||||
nnoremap <silent> <Plug>(go-coverage-browser) :<C-u>call go#coverage#Browser(!g:go_jump_to_error)<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#tool#Info(0)<CR>
|
||||
nnoremap <silent> <Plug>(go-import) :<C-u>call go#import#SwitchImport(1, '', expand('<cword>'), '')<CR>
|
||||
nnoremap <silent> <Plug>(go-imports) :<C-u>call go#fmt#Format(1)<CR>
|
||||
|
||||
nnoremap <silent> <Plug>(go-implements) :<C-u>call go#guru#Implements(-1)<CR>
|
||||
nnoremap <silent> <Plug>(go-callees) :<C-u>call go#guru#Callees(-1)<CR>
|
||||
nnoremap <silent> <Plug>(go-callers) :<C-u>call go#guru#Callers(-1)<CR>
|
||||
nnoremap <silent> <Plug>(go-describe) :<C-u>call go#guru#Describe(-1)<CR>
|
||||
nnoremap <silent> <Plug>(go-callstack) :<C-u>call go#guru#Callstack(-1)<CR>
|
||||
xnoremap <silent> <Plug>(go-freevars) :<C-u>call go#guru#Freevars(0)<CR>
|
||||
nnoremap <silent> <Plug>(go-channelpeers) :<C-u>call go#guru#ChannelPeers(-1)<CR>
|
||||
nnoremap <silent> <Plug>(go-referrers) :<C-u>call go#guru#Referrers(-1)<CR>
|
||||
nnoremap <silent> <Plug>(go-sameids) :<C-u>call go#guru#SameIds()<CR>
|
||||
nnoremap <silent> <Plug>(go-whicherrs) :<C-u>call go#guru#Whicherrs(-1)<CR>
|
||||
nnoremap <silent> <Plug>(go-sameids-toggle) :<C-u>call go#guru#ToggleSameIds()<CR>
|
||||
|
||||
nnoremap <silent> <Plug>(go-rename) :<C-u>call go#rename#Rename(!g:go_jump_to_error)<CR>
|
||||
|
||||
nnoremap <silent> <Plug>(go-def) :<C-u>call go#def#Jump('')<CR>
|
||||
nnoremap <silent> <Plug>(go-def-vertical) :<C-u>call go#def#Jump("vsplit")<CR>
|
||||
nnoremap <silent> <Plug>(go-def-split) :<C-u>call go#def#Jump("split")<CR>
|
||||
nnoremap <silent> <Plug>(go-def-tab) :<C-u>call go#def#Jump("tab")<CR>
|
||||
|
||||
nnoremap <silent> <Plug>(go-def-pop) :<C-u>call go#def#StackPop()<CR>
|
||||
nnoremap <silent> <Plug>(go-def-stack) :<C-u>call go#def#Stack()<CR>
|
||||
nnoremap <silent> <Plug>(go-def-stack-clear) :<C-u>call go#def#StackClear()<CR>
|
||||
|
||||
nnoremap <silent> <Plug>(go-doc) :<C-u>call go#doc#Open("new", "split")<CR>
|
||||
nnoremap <silent> <Plug>(go-doc-tab) :<C-u>call go#doc#Open("tabnew", "tabe")<CR>
|
||||
nnoremap <silent> <Plug>(go-doc-vertical) :<C-u>call go#doc#Open("vnew", "vsplit")<CR>
|
||||
nnoremap <silent> <Plug>(go-doc-split) :<C-u>call go#doc#Open("new", "split")<CR>
|
||||
nnoremap <silent> <Plug>(go-doc-browser) :<C-u>call go#doc#OpenBrowser()<CR>
|
||||
|
||||
nnoremap <silent> <Plug>(go-metalinter) :<C-u>call go#lint#Gometa(0)<CR>
|
||||
nnoremap <silent> <Plug>(go-lint) :<C-u>call go#lint#Golint()<CR>
|
||||
nnoremap <silent> <Plug>(go-vet) :<C-u>call go#lint#Vet(!g:go_jump_to_error)<CR>
|
||||
|
||||
nnoremap <silent> <Plug>(go-alternate-edit) :<C-u>call go#alternate#Switch(0, "edit")<CR>
|
||||
nnoremap <silent> <Plug>(go-alternate-vertical) :<C-u>call go#alternate#Switch(0, "vsplit")<CR>
|
||||
nnoremap <silent> <Plug>(go-alternate-split) :<C-u>call go#alternate#Switch(0, "split")<CR>
|
||||
|
||||
" vim: sw=2 ts=2 et
|
@ -5,32 +5,44 @@ let g:go_loaded_gosnippets = 1
|
||||
|
||||
" by default UltiSnips
|
||||
if !exists("g:go_snippet_engine")
|
||||
let g:go_snippet_engine = "ultisnips"
|
||||
let g:go_snippet_engine = "ultisnips"
|
||||
endif
|
||||
|
||||
function! s:GoUltiSnips()
|
||||
if globpath(&rtp, 'plugin/UltiSnips.vim') == ""
|
||||
return
|
||||
endif
|
||||
if globpath(&rtp, 'plugin/UltiSnips.vim') == ""
|
||||
return
|
||||
endif
|
||||
|
||||
if !exists("g:UltiSnipsSnippetDirectories")
|
||||
let g:UltiSnipsSnippetDirectories = ["gosnippets/UltiSnips"]
|
||||
else
|
||||
let g:UltiSnipsSnippetDirectories += ["gosnippets/UltiSnips"]
|
||||
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
|
||||
if globpath(&rtp, 'plugin/neosnippet.vim') == ""
|
||||
return
|
||||
endif
|
||||
|
||||
let g:neosnippet#enable_snipmate_compatibility = 1
|
||||
exec 'NeoSnippetSource' globpath(&rtp, 'gosnippets/snippets/go.snip')
|
||||
let g:neosnippet#enable_snipmate_compatibility = 1
|
||||
|
||||
let gosnippets_dir = globpath(&rtp, 'gosnippets/snippets')
|
||||
if type(g:neosnippet#snippets_directory) == type([])
|
||||
let g:neosnippet#snippets_directory += [gosnippets_dir]
|
||||
elseif type(g:neosnippet#snippets_directory) == type("")
|
||||
if strlen(g:neosnippet#snippets_directory) > 0
|
||||
let g:neosnippet#snippets_directory = g:neosnippet#snippets_directory . "," . gosnippets_dir
|
||||
else
|
||||
let g:neosnippet#snippets_directory = gosnippets_dir
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
if g:go_snippet_engine == "ultisnips"
|
||||
call s:GoUltiSnips()
|
||||
call s:GoUltiSnips()
|
||||
elseif g:go_snippet_engine == "neosnippet"
|
||||
call s:GoNeosnippet()
|
||||
call s:GoNeosnippet()
|
||||
endif
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
@ -1,55 +1,57 @@
|
||||
" Check if tagbar is installed under plugins or is directly under rtp
|
||||
" this covers pathgen + Vundle/Bundle
|
||||
" this covers pathogen + Vundle/Bundle
|
||||
"
|
||||
" Also make sure the ctags command exists
|
||||
"
|
||||
if !executable('ctags')
|
||||
finish
|
||||
finish
|
||||
elseif globpath(&rtp, 'plugin/tagbar.vim') == ""
|
||||
finish
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("g:go_gotags_bin")
|
||||
let g:go_gotags_bin = "gotags"
|
||||
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
|
||||
let bin_path = go#path#CheckBinPath(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
|
||||
if !exists("g:tagbar_type_go")
|
||||
let g:tagbar_type_go = {
|
||||
\ 'ctagstype' : 'go',
|
||||
\ 'kinds' : [
|
||||
\ 'p:package',
|
||||
\ 'i:imports',
|
||||
\ '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' : bin_path,
|
||||
\ 'ctagsargs' : '-sort -silent'
|
||||
\ }
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
call s:SetTagbar()
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
8
sources_non_forked/vim-go/ftplugin/gohtmltmpl.vim
Normal file
8
sources_non_forked/vim-go/ftplugin/gohtmltmpl.vim
Normal file
@ -0,0 +1,8 @@
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
setlocal commentstring=<!--\ %s\ -->
|
||||
|
||||
" vim: sw=2 ts=2 et
|
Reference in New Issue
Block a user