Skip to content

Commit

Permalink
Release v0.0.78
Browse files Browse the repository at this point in the history
  • Loading branch information
chemzqm committed Apr 10, 2020
1 parent cae9778 commit 705f94f
Show file tree
Hide file tree
Showing 9 changed files with 1,035 additions and 756 deletions.
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'}
```

in your `.vimrc` or `init.vim`, then restart Vim and run `:PlugInstall`.

Checkout [Install
coc.nvim](https://github.com/neoclide/coc.nvim/wiki/Install-coc.nvim) Wiki for
more info.
Expand Down Expand Up @@ -98,8 +99,7 @@ inoremap <silent><expr> <c-space> coc#refresh()
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
" position. Coc only does snippet and additional edit on confirm.
if has('patch8.1.1068')
" Use `complete_info` if your (Neo)Vim version supports it.
if exists('*complete_info')
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
else
imap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
Expand Down
3 changes: 3 additions & 0 deletions autoload/coc/api.vim
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ function! s:funcs.buf_set_lines(bufnr, start, end, strict, ...) abort
let changeBuffer = 1
exe 'buffer '.a:bufnr
endif
let storeView = winsaveview()
if a:bufnr == curr || changeBuffer
" replace
if delCount == len(replacement)
Expand All @@ -361,6 +362,7 @@ function! s:funcs.buf_set_lines(bufnr, start, end, strict, ...) abort
let @" = saved_reg
endif
endif
call winrestview(storeView)
if changeBuffer
exe 'buffer '.curr
endif
Expand All @@ -380,6 +382,7 @@ function! s:funcs.buf_set_lines(bufnr, start, end, strict, ...) abort
call deletebufline(a:bufnr, start, start + delCount - 1)
endif
endif
call winrestview(storeView)
endif
endfunction

Expand Down
30 changes: 30 additions & 0 deletions autoload/coc/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,36 @@ function! coc#util#with_callback(method, args, cb)
call timer_start(timeout, {-> s:Cb() })
endfunction

function! coc#util#quickpick(title, items, cb) abort
if exists('*popup_menu')
function! s:QuickpickHandler(id, result) closure
call a:cb(v:null, a:result)
endfunction
function! s:QuickpickFilter(id, key) closure
for i in range(1, len(a:items))
if a:key == string(i)
call popup_close(a:id, i)
return 1
endif
endfor
" No shortcut, pass to generic filter
return popup_filter_menu(a:id, a:key)
endfunction
try
call popup_menu(a:items, #{
\ title: a:title,
\ filter: function('s:QuickpickFilter'),
\ callback: function('s:QuickpickHandler'),
\ })
catch /.*/
call a:cb(v:exception)
endtry
else
let res = inputlist([a:title] + a:items)
call a:cb(v:null, res)
endif
endfunction

function! coc#util#add_matchids(ids)
let w:coc_matchids = get(w:, 'coc_matchids', []) + a:ids
endfunction
Expand Down
Loading

0 comments on commit 705f94f

Please sign in to comment.