mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins
This commit is contained in:
@ -1,20 +1,20 @@
|
||||
function! go#keyify#Keyify()
|
||||
let bin_path = go#path#CheckBinPath("keyify")
|
||||
let fname = fnamemodify(expand("%"), ':p:gs?\\?/?')
|
||||
" Needs: https://github.com/dominikh/go-tools/pull/272
|
||||
"\ '-tags', go#config#BuildTags(),
|
||||
let l:cmd = ['keyify',
|
||||
\ '-json',
|
||||
\ printf('%s:#%s', fnamemodify(expand('%'), ':p:gs?\\?/?'), go#util#OffsetCursor())]
|
||||
|
||||
if empty(bin_path) || !exists('*json_decode')
|
||||
let [l:out, l:err] = go#util#Exec(l:cmd)
|
||||
if l:err
|
||||
call go#util#EchoError("non-zero exit code: " . l:out)
|
||||
return
|
||||
endif
|
||||
|
||||
" Get result of command as json, that contains `start`, `end` and `replacement`
|
||||
let command = printf("%s -json %s:#%s", go#util#Shellescape(bin_path),
|
||||
\ go#util#Shellescape(fname), go#util#OffsetCursor())
|
||||
let output = go#util#System(command)
|
||||
silent! let result = json_decode(output)
|
||||
silent! let result = json_decode(l:out)
|
||||
|
||||
" We want to output the error message in case the result isn't a JSON
|
||||
if type(result) != type({})
|
||||
call go#util#EchoError(s:chomp(output))
|
||||
call go#util#EchoError(s:chomp(l:out))
|
||||
return
|
||||
endif
|
||||
|
||||
|
Reference in New Issue
Block a user