mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
let s:sock_type = (has('win32') || has('win64')) ? 'tcp' : 'unix'
|
||||
|
||||
function! s:gocodeCurrentBuffer()
|
||||
function! s:gocodeCurrentBuffer() abort
|
||||
let buf = getline(1, '$')
|
||||
if &encoding != 'utf-8'
|
||||
let buf = map(buf, 'iconv(v:val, &encoding, "utf-8")')
|
||||
@ -16,7 +16,7 @@ function! s:gocodeCurrentBuffer()
|
||||
return file
|
||||
endfunction
|
||||
|
||||
function! s:gocodeCommand(cmd, preargs, args)
|
||||
function! s:gocodeCommand(cmd, preargs, args) abort
|
||||
for i in range(0, len(a:args) - 1)
|
||||
let a:args[i] = go#util#Shellescape(a:args[i])
|
||||
endfor
|
||||
@ -59,12 +59,12 @@ function! s:gocodeCommand(cmd, preargs, args)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:gocodeCurrentBufferOpt(filename)
|
||||
function! s:gocodeCurrentBufferOpt(filename) abort
|
||||
return '-in=' . a:filename
|
||||
endfunction
|
||||
|
||||
let s:optionsEnabled = 0
|
||||
function! s:gocodeEnableOptions()
|
||||
function! s:gocodeEnableOptions() abort
|
||||
if s:optionsEnabled
|
||||
return
|
||||
endif
|
||||
@ -78,14 +78,14 @@ 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))))
|
||||
call go#util#System(printf('%s set unimported-packages %s', go#util#Shellescape(bin_path), s:toBool(get(g:, 'go_gocode_unimported_packages', 0))))
|
||||
endfunction
|
||||
|
||||
function! s:toBool(val)
|
||||
function! s:toBool(val) abort
|
||||
if a:val | return 'true ' | else | return 'false' | endif
|
||||
endfunction
|
||||
|
||||
function! s:gocodeAutocomplete()
|
||||
function! s:gocodeAutocomplete() abort
|
||||
call s:gocodeEnableOptions()
|
||||
|
||||
let filename = s:gocodeCurrentBuffer()
|
||||
@ -96,7 +96,7 @@ function! s:gocodeAutocomplete()
|
||||
return result
|
||||
endfunction
|
||||
|
||||
function! go#complete#GetInfo()
|
||||
function! go#complete#GetInfo() abort
|
||||
let offset = go#util#OffsetCursor()+1
|
||||
let filename = s:gocodeCurrentBuffer()
|
||||
let result = s:gocodeCommand('autocomplete',
|
||||
@ -137,7 +137,7 @@ function! go#complete#GetInfo()
|
||||
return ""
|
||||
endfunction
|
||||
|
||||
function! go#complete#Info(auto)
|
||||
function! go#complete#Info(auto) abort
|
||||
" auto is true if we were called by g:go_auto_type_info's autocmd
|
||||
let result = go#complete#GetInfo()
|
||||
if !empty(result)
|
||||
@ -147,12 +147,12 @@ function! go#complete#Info(auto)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:trim_bracket(val)
|
||||
function! s:trim_bracket(val) abort
|
||||
let a:val.word = substitute(a:val.word, '[(){}\[\]]\+$', '', '')
|
||||
return a:val
|
||||
endfunction
|
||||
|
||||
function! go#complete#Complete(findstart, base)
|
||||
function! go#complete#Complete(findstart, base) abort
|
||||
"findstart = 1 when we need to get the text length
|
||||
if a:findstart == 1
|
||||
execute "silent let g:gocomplete_completions = " . s:gocodeAutocomplete()
|
||||
@ -167,7 +167,7 @@ function! go#complete#Complete(findstart, base)
|
||||
endif
|
||||
endf
|
||||
|
||||
function! go#complete#ToggleAutoTypeInfo()
|
||||
function! go#complete#ToggleAutoTypeInfo() abort
|
||||
if get(g:, "go_auto_type_info", 0)
|
||||
let g:go_auto_type_info = 0
|
||||
call go#util#EchoProgress("auto type info disabled")
|
||||
|
Reference in New Issue
Block a user