mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
" asm.vim: Vim filetype plugin for Go assembler.
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
@ -15,3 +15,5 @@ setlocal commentstring=//\ %s
|
||||
setlocal noexpandtab
|
||||
|
||||
command! -nargs=0 AsmFmt call go#asmfmt#Format()
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
@ -5,7 +5,7 @@
|
||||
" go.vim: Vim filetype plugin for Go.
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
@ -24,40 +24,40 @@ compiler go
|
||||
setlocal omnifunc=go#complete#Complete
|
||||
|
||||
if get(g:, "go_doc_keywordprg_enabled", 1)
|
||||
" keywordprg doesn't allow to use vim commands, override it
|
||||
nnoremap <buffer> <silent> K :GoDoc<cr>
|
||||
" keywordprg doesn't allow to use vim commands, override it
|
||||
nnoremap <buffer> <silent> K :GoDoc<cr>
|
||||
endif
|
||||
|
||||
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>
|
||||
" 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 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>
|
||||
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>
|
||||
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>
|
||||
" 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>
|
||||
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>
|
||||
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
|
||||
|
||||
if get(g:, "go_auto_type_info", 0)
|
||||
setlocal updatetime=800
|
||||
setlocal updatetime=800
|
||||
endif
|
||||
|
||||
" vim:ts=4:sw=4:et
|
||||
" vim: sw=2 ts=2 et
|
||||
|
@ -76,4 +76,4 @@ endif
|
||||
" -- impl
|
||||
command! -nargs=* -buffer -complete=customlist,go#impl#Complete GoImpl call go#impl#Impl(<f-args>)
|
||||
|
||||
" vim:ts=4:sw=4:et
|
||||
" vim: sw=2 ts=2 et
|
||||
|
@ -5,16 +5,16 @@
|
||||
" 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
|
||||
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>
|
||||
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>
|
||||
@ -70,3 +70,5 @@ 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,42 +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
|
||||
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
|
||||
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
|
||||
|
@ -4,52 +4,54 @@
|
||||
" 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#path#CheckBinPath(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',
|
||||
\ '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' : expand(bin_path),
|
||||
\ 'ctagsargs' : '-sort -silent'
|
||||
\ }
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
call s:SetTagbar()
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
@ -1,6 +1,8 @@
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
setlocal commentstring=<!--\ %s\ -->
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
Reference in New Issue
Block a user