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

Update coc.nvim.

This commit is contained in:
Kurtis Moxley
2022-07-20 13:20:15 +08:00
parent a15d617ae4
commit 225f27e9d6
375 changed files with 93651 additions and 505 deletions

View File

@ -182,14 +182,10 @@ function! coc#util#jump(cmd, filepath, ...) abort
else
exec 'drop '.fnameescape(file)
endif
elseif a:cmd == 'edit'
if bufloaded(file)
exe 'b '.bufnr(file)
else
exe a:cmd.' '.fnameescape(file)
endif
elseif a:cmd == 'edit' && bufloaded(file)
exe 'b '.bufnr(file)
else
exe a:cmd.' '.fnameescape(file)
call s:safer_open(a:cmd, file)
endif
if !empty(get(a:, 1, []))
let line = getline(a:1[0] + 1)
@ -208,6 +204,32 @@ function! coc#util#jump(cmd, filepath, ...) abort
endif
endfunction
function! s:safer_open(cmd, file) abort
" How to support :pedit and :drop?
let is_supported_cmd = index(["edit", "split", "vsplit", "tabe"], a:cmd) >= 0
" Use special handling only for URI.
let looks_like_uri = match(a:file, "^.*://") >= 0
if looks_like_uri && is_supported_cmd && has('win32') && exists('*bufadd')
" Workaround a bug for Win32 paths.
"
" reference:
" - https://github.com/vim/vim/issues/541
" - https://github.com/neoclide/coc-java/issues/82
" - https://github.com/vim-jp/issues/issues/6
let buf = bufadd(a:file)
if a:cmd != 'edit'
" Open split, tab, etc. by a:cmd.
exe a:cmd
endif
" Set current buffer to the file
exe 'keepjumps buffer ' . buf
else
exe a:cmd.' '.fnameescape(a:file)
endif
endfunction
function! coc#util#variables(bufnr) abort
let info = getbufinfo(a:bufnr)
let variables = empty(info) ? {} : copy(info[0]['variables'])