mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated vim plugins
This commit is contained in:
@ -2,10 +2,20 @@
|
||||
|
||||
* We have now a [logo for vim-go](https://github.com/fatih/vim-go/blob/master/assets/vim-go.png)! Thanks to @egonelbre for his work on this.
|
||||
|
||||
IMPROVEMENTS:
|
||||
|
||||
* Function calls are now highligted as wel when `g:go_highlight_functions` is enabled [gh-1048]
|
||||
* Add completion support for uninported packages. This allows to complete even if the package is not improted [gh-1084]
|
||||
* Tools that embeds GOROOT into their binaries do not work when people update their Go version and the GOROOT contains the vesion as part of their path (i.e: `/usr/local/Cellar/go/1.7.2/libexec`, [more info](https://blog.filippo.io/stale-goroot-and-gorebuild/)) . This is now fixed by introducing automatic GOROOT set/unset before each tool invoke. [gh-954]
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
* Change back nil and iota highlighting color to the old type [gh-1049]
|
||||
* Fix passing arguments to `:GoBuild` while using NeoVim [gh-1062]
|
||||
* Do not open a split if `:GoDef` is used on a modified file [gh-1083]
|
||||
* Highlight nested structs correctly [gh-1075]
|
||||
* Highlight builtin functions correctly if `g:go_highlight_functions` is enabled [gh-1070]
|
||||
* Fix `:GoSameIds` highlighting if a new buffer is opened in the same window [gh-1067]
|
||||
|
||||
## 1.9 (September 13, 2016)
|
||||
|
||||
|
@ -56,3 +56,5 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The Go gopher was designed by Renee French. http://reneefrench.blogspot.com/ The design is licensed under the Creative Commons 3.0 Attributions license. Read this article for more details: https://blog.golang.org/gopher
|
||||
|
@ -32,7 +32,9 @@ function! s:gocodeCommand(cmd, preargs, args)
|
||||
" we might hit cache problems, as gocode doesn't handle well different
|
||||
" GOPATHS: https://github.com/nsf/gocode/issues/239
|
||||
let old_gopath = $GOPATH
|
||||
let old_goroot = $GOROOT
|
||||
let $GOPATH = go#path#Detect()
|
||||
let $GOROOT = go#util#env("goroot")
|
||||
|
||||
let socket_type = get(g:, 'go_gocode_socket_type', s:sock_type)
|
||||
let cmd = printf('%s -sock %s %s %s %s',
|
||||
@ -45,6 +47,8 @@ function! s:gocodeCommand(cmd, preargs, args)
|
||||
|
||||
let result = go#util#System(cmd)
|
||||
let $GOPATH = old_gopath
|
||||
let $GOROOT = old_goroot
|
||||
|
||||
if go#util#ShellError() != 0
|
||||
return "[\"0\", []]"
|
||||
else
|
||||
@ -74,6 +78,7 @@ function! s:gocodeEnableOptions()
|
||||
|
||||
call go#util#System(printf('%s set propose-builtins %s', go#util#Shellescape(bin_path), s:toBool(get(g:, 'go_gocode_propose_builtins', 1))))
|
||||
call go#util#System(printf('%s set autobuild %s', go#util#Shellescape(bin_path), s:toBool(get(g:, 'go_gocode_autobuild', 1))))
|
||||
call go#util#System(printf('%s set unimported-packages %s', go#util#Shellescape(bin_path), s:toBool(get(g:, 'go_gocode_unimported_packages', 1))))
|
||||
endfunction
|
||||
|
||||
function! s:toBool(val)
|
||||
|
@ -129,8 +129,6 @@ function! s:jump_to_declaration(out, mode)
|
||||
split
|
||||
elseif a:mode == "vsplit"
|
||||
vsplit
|
||||
elseif &modified
|
||||
split
|
||||
endif
|
||||
|
||||
" open the file and jump to line and column
|
||||
|
@ -121,7 +121,9 @@ endfunction
|
||||
|
||||
function! go#tool#ExecuteInDir(cmd) abort
|
||||
let old_gopath = $GOPATH
|
||||
let old_goroot = $GOROOT
|
||||
let $GOPATH = go#path#Detect()
|
||||
let $GOROOT = go#util#env("goroot")
|
||||
|
||||
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
|
||||
let dir = getcwd()
|
||||
@ -132,6 +134,7 @@ function! go#tool#ExecuteInDir(cmd) abort
|
||||
execute cd . fnameescape(dir)
|
||||
endtry
|
||||
|
||||
let $GOROOT = old_goroot
|
||||
let $GOPATH = old_gopath
|
||||
return out
|
||||
endfunction
|
||||
|
@ -43,6 +43,31 @@ function! go#util#IsWin()
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
let s:env_cache = {}
|
||||
|
||||
" env returns the go environment variable for the given key. Where key can be
|
||||
" GOARCH, GOOS, GOROOT, etc... It caches the result and returns the cached
|
||||
" version.
|
||||
function! go#util#env(key)
|
||||
let l:key = tolower(a:key)
|
||||
if has_key(s:env_cache, l:key)
|
||||
return s:env_cache[l:key]
|
||||
endif
|
||||
|
||||
if executable('go')
|
||||
let l:var = call('go#util#'.l:key, [])
|
||||
if go#util#ShellError() != 0
|
||||
call go#util#EchoError(printf("'go env %s' failed", toupper(l:key)))
|
||||
return ''
|
||||
endif
|
||||
else
|
||||
let l:var = eval("$".toupper(a:key))
|
||||
endif
|
||||
|
||||
let s:env_cache[l:key] = l:var
|
||||
return l:var
|
||||
endfunction
|
||||
|
||||
function! go#util#goarch()
|
||||
return substitute(go#util#System('go env GOARCH'), '\n', '', 'g')
|
||||
endfunction
|
||||
|
@ -1396,6 +1396,12 @@ to an autocompletion proposals. By default it is enabled.
|
||||
>
|
||||
let g:go_gocode_propose_builtins = 1
|
||||
<
|
||||
*'g:go_gocode_unimported_packages'*
|
||||
|
||||
Specifies whether `gocode` should include suggestions from unimported packages.
|
||||
By default it is enabled
|
||||
>
|
||||
let g:go_gocode_unimported_packages = 1
|
||||
*'g:go_gocode_socket_type'*
|
||||
|
||||
Specifies whether `gocode` should use a different socket type. By default
|
||||
|
@ -200,6 +200,10 @@ augroup vim-go
|
||||
autocmd BufWritePre *.s call s:asmfmt_autosave()
|
||||
autocmd BufWritePost *.go call s:metalinter_autosave()
|
||||
autocmd BufNewFile *.go call s:template_autocreate()
|
||||
" clear SameIds when the buffer is unloaded so that loading another buffer
|
||||
" in the same window doesn't highlight the most recently matched
|
||||
" identifier's positions.
|
||||
autocmd BufWinEnter *.go call go#guru#ClearSameIds()
|
||||
augroup END
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
@ -302,16 +302,18 @@ if g:go_highlight_functions != 0
|
||||
syn match goPointerOperator /\*/ nextgroup=goReceiverType contained skipwhite skipnl
|
||||
syn match goReceiverType /\w\+/ contained
|
||||
syn match goFunction /\w\+/ contained
|
||||
syn match goFunctionCall /\w\+\ze(/ contains=GoBuiltins,goDeclaration
|
||||
else
|
||||
syn keyword goDeclaration func
|
||||
endif
|
||||
hi def link goFunction Function
|
||||
hi def link goFunctionCall Type
|
||||
|
||||
" Methods;
|
||||
if g:go_highlight_methods != 0
|
||||
syn match goMethod /\.\w\+\ze(/hs=s+1
|
||||
syn match goMethodCall /\.\w\+\ze(/hs=s+1
|
||||
endif
|
||||
hi def link goMethod Type
|
||||
hi def link goMethodCall Type
|
||||
|
||||
" Fields;
|
||||
if g:go_highlight_fields != 0
|
||||
@ -324,7 +326,7 @@ if g:go_highlight_types != 0
|
||||
syn match goTypeConstructor /\<\w\+{/he=e-1
|
||||
syn match goTypeDecl /\<type\>/ nextgroup=goTypeName skipwhite skipnl
|
||||
syn match goTypeName /\w\+/ contained nextgroup=goDeclType skipwhite skipnl
|
||||
syn match goDeclType /\<interface\|struct\>/ contained skipwhite skipnl
|
||||
syn match goDeclType /\<interface\|struct\>/ skipwhite skipnl
|
||||
hi def link goReceiverType Type
|
||||
else
|
||||
syn keyword goDeclType struct interface
|
||||
|
Reference in New Issue
Block a user