1
0
mirror of https://github.com/amix/vimrc synced 2025-07-01 12:45:00 +08:00

Updated plugins

This commit is contained in:
Amir
2022-08-08 15:45:56 +02:00
parent b41536726f
commit 765adb9da3
216 changed files with 4784 additions and 2112 deletions

View File

@ -197,22 +197,27 @@ function! rhubarb#Request(path, ...) abort
if exists('*FugitiveExecute') && v:version >= 800
try
if has_key(options, 'callback')
return FugitiveExecute({'argv': args}, { r -> r.exit_status || r.stdout ==# [''] ? '' : options.callback(json_decode(join(r.stdout, ' '))) })
return FugitiveExecute({'argv': args},
\ { r -> r.exit_status || r.stdout ==# [''] ? '' : call(options.callback, [json_decode(join(r.stdout, ' '))] + get(options, 'callback_args', [])) })
endif
let raw = join(FugitiveExecute({'argv': args}).stdout, ' ')
return empty(raw) ? raw : json_decode(raw)
if empty(raw)
throw 'rhubarb: bug? empty response from ' . path
else
return json_decode(raw)
endif
catch /^fugitive:/
endtry
endif
let raw = system(join(map(copy(args), 's:shellesc(v:val)'), ' '))
silent let raw = system(join(map(copy(args), 's:shellesc(v:val)'), ' '))
if has_key(options, 'callback')
if !v:shell_error && !empty(raw)
call options.callback(rhubarb#JsonDecode(raw))
call call(options.callback, [rhubarb#JsonDecode(raw)] + get(options, 'callback_args', []))
endif
return {}
endif
if raw ==# ''
return raw
if empty(raw)
throw 'rhubarb: bug? empty response from ' . path
else
return rhubarb#JsonDecode(raw)
endif
@ -244,6 +249,21 @@ endfunction
" Section: Issues
function! s:CompleteAddIssues(response, prefix) abort
for issue in get(a:response, 'items', [])
call complete_add({
\ 'word': a:prefix . issue.number,
\ 'abbr': '#' . issue.number,
\ 'menu': issue.title,
\ 'info': substitute(empty(issue.body) ? "\n" : issue.body,'\r','','g'),
\ })
endfor
if !has_key(a:response, 'message')
return
endif
throw 'rhubarb: ' . a:response.message
endfunction
let s:reference = '\<\%(\c\%(clos\|resolv\|referenc\)e[sd]\=\|\cfix\%(e[sd]\)\=\)\>'
function! rhubarb#Complete(findstart, base) abort
if a:findstart
@ -261,20 +281,12 @@ function! rhubarb#Complete(findstart, base) abort
let prefix = s:repo_homepage().'/issues/'
let query = a:base
endif
let response = rhubarb#RepoSearch('issues', 'state:open '.query)
if type(response) != type({})
call s:throw('unknown error')
elseif has_key(response, 'message')
call s:throw(response.message)
else
let issues = get(response, 'items', [])
endif
return map(issues, '{"word": prefix.v:val.number, "abbr": "#".v:val.number, "menu": v:val.title, "info": substitute(empty(v:val.body) ? "\n" : v:val.body,"\\r","","g")}')
let response = rhubarb#RepoSearch('issues', 'state:open ' . query)
call s:CompleteAddIssues(response, prefix)
endif
catch /^rhubarb:.*is not a GitHub repository/
return []
catch /^\%(fugitive\|rhubarb\):/
echoerr v:errmsg
echoerr v:exception
endtry
endfunction
@ -295,15 +307,14 @@ function! rhubarb#FugitiveUrl(...) abort
return ''
endif
let path = substitute(opts.path, '^/', '', '')
if path =~# '^\.git/refs/heads/'
return root . '/commits/' . path[16:-1]
elseif path =~# '^\.git/refs/tags/'
return root . '/releases/tag/' . path[15:-1]
elseif path =~# '^\.git/refs/remotes/[^/]\+/.'
return root . '/commits/' . matchstr(path,'remotes/[^/]\+/\zs.*')
elseif path =~# '^\.git/\%(config$\|hooks\>\)'
return root . '/admin'
elseif path =~# '^\.git\>'
let ref = matchstr(opts.path, '^/\=\.git/\zsrefs/.*')
if ref =~# '^refs/heads/'
return root . '/commits/' . ref[11:-1]
elseif ref =~# '^refs/tags/'
return root . '/releases/tag/' . ref[10:-1]
elseif ref =~# '^refs/remotes/[^/]\+/.'
return root . '/commits/' . matchstr(ref,'remotes/[^/]\+/\zs.*')
elseif opts.path =~# '^/\=\.git\>'
return root
endif
let commit = opts.commit