1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 09:35:01 +08:00

Updated vim plugins

This commit is contained in:
amix
2016-08-20 13:23:52 +02:00
parent 61a22e9f3e
commit f8d1d3bb50
27 changed files with 264 additions and 208 deletions

View File

@ -6,10 +6,15 @@ IMPROVEMENTS:
buffers as well. This affects all commands where `guru` is used. Such as
`:GoDef`, `:GoReferrers`, etc.. [gh-944]
* Cleanup and improve documentation [gh-987]
* Add new `g:go_gocode_socket_type` setting to change the underlying socket type passed to `gocode`. Usefull to fallback to `tcp` on cases such as Bash on Windows [gh-1000]
* `:GoSameIds` is now automatically re-evaluated in cases of buffer reloads (such as `:GoRename`) [gh-998]
BUG FIXES:
* Fix system calls on Windows [gh-988]
* Fix :GoSameIds and :GoCoverage for light background and after changing color schemes [gh-983]
* Fix TagBar and `GoCallers` for Windows user [gh-999]
* Set updatetime for for `auto_sameids` feature as well [gh-1016]
## 1.8 (July 31, 2016)

View File

@ -32,10 +32,17 @@ function! s:gocodeCommand(cmd, preargs, args)
let old_gopath = $GOPATH
let $GOPATH = go#path#Detect()
let result = go#util#System(printf('%s %s %s %s', go#util#Shellescape(bin_path), join(a:preargs), go#util#Shellescape(a:cmd), join(a:args)))
let socket_type = get(g:, 'go_gocode_socket_type', 'unix')
let cmd = printf('%s -sock %s %s %s %s',
\ go#util#Shellescape(bin_path),
\ socket_type,
\ join(a:preargs),
\ go#util#Shellescape(a:cmd),
\ join(a:args)
\ )
let result = go#util#System(cmd)
let $GOPATH = old_gopath
if go#util#ShellError() != 0
return "[\"0\", []]"
else

View File

@ -1,6 +1,5 @@
" guru.vim -- Vim integration for the Go guru.
func! s:RunGuru(mode, format, selected, needs_scope) range abort
"return with a warning if the binary doesn't exist
let bin_path = go#path#CheckBinPath("guru")
@ -364,6 +363,12 @@ function! go#guru#SameIds(selected)
let pos = split(item, ':')
call matchaddpos('goSameId', [[str2nr(pos[-2]), str2nr(pos[-1]), str2nr(poslen)]])
endfor
if get(g:, "go_auto_sameids", 0)
" re-apply SameIds at the current cursor position at the time the buffer
" is redisplayed: e.g. :edit, :GoRename, etc.
autocmd BufWinEnter <buffer> nested call go#guru#SameIds(-1)
endif
endfunction
function! go#guru#ClearSameIds()
@ -373,6 +378,11 @@ function! go#guru#ClearSameIds()
call matchdelete(item['id'])
endif
endfor
" remove the autocmds we defined
if exists("#BufWinEnter<buffer>")
autocmd! BufWinEnter <buffer>
endif
endfunction
function! go#guru#ToggleSameIds(selected)

View File

@ -59,7 +59,7 @@ function! go#package#ImportPath(arg)
let dirs = go#package#Paths()
for dir in dirs
if len(dir) && match(path, dir) == 0
if len(dir) && matchstr(escape(path, '\/'), escape(dir, '\/')) == 0
let workspace = dir
endif
endfor
@ -68,8 +68,13 @@ function! go#package#ImportPath(arg)
return -1
endif
let srcdir = substitute(workspace . '/src/', '//', '/', '')
return substitute(path, srcdir, '', '')
if go#util#IsWin()
let srcdir = substitute(workspace . '\src\', '//', '/', '')
return path[len(srcdir):]
else
let srcdir = substitute(workspace . '/src/', '//', '/', '')
return substitute(path, srcdir, '', '')
endif
endfunction
function! go#package#FromPath(arg)

View File

@ -1387,6 +1387,13 @@ Specifies whether `gocode` should add built-in types, functions and constants
to an autocompletion proposals. By default it is enabled.
>
let g:go_gocode_propose_builtins = 1
<
*'g:go_gocode_socket_type'*
Specifies whether `gocode` should use a different socket type. By default
`unix` is enabled. Possible values: `unix`, `tcp`
>
let g:go_gocode_socket_type = 'unix'
<
*'g:go_template_autocreate'*

View File

@ -56,7 +56,7 @@ if get(g:, "go_textobj_enabled", 1)
xnoremap <buffer> <silent> [[ :<c-u>call go#textobj#FunctionJump('v', 'prev')<cr>
endif
if get(g:, "go_auto_type_info", 0)
if get(g:, "go_auto_type_info", 0) || get(g:, "go_auto_sameids", 0)
setlocal updatetime=800
endif

View File

@ -45,7 +45,7 @@ function! s:SetTagbar()
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : expand(bin_path),
\ 'ctagsbin' : bin_path,
\ 'ctagsargs' : '-sort -silent'
\ }
endif

View File

@ -366,13 +366,27 @@ if g:go_highlight_build_constraints != 0
hi def link goPackageComment Comment
endif
" :GoSameIds
hi def goSameId term=bold cterm=bold ctermbg=white ctermfg=black
" :GoCoverage commands
hi def link goCoverageNormalText Comment
hi def goCoverageCovered ctermfg=green guifg=#A6E22E
hi def goCoverageUncover ctermfg=red guifg=#F92672
function! s:hi()
" :GoSameIds
if &background == 'dark'
hi def goSameId term=bold cterm=bold ctermbg=white ctermfg=black guibg=white guifg=black
else
hi def goSameId term=bold cterm=bold ctermbg=14 guibg=Cyan
endif
" :GoCoverage commands
hi def goCoverageCovered ctermfg=green guifg=#A6E22E
hi def goCoverageUncover ctermfg=red guifg=#F92672
endfunction
augroup vim-go-hi
autocmd!
autocmd ColorScheme * call s:hi()
augroup end
call s:hi()
" Search backwards for a global declaration to start processing the syntax.
"syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/