Skip to content

Commit

Permalink
Manually cancel snippet session
Browse files Browse the repository at this point in the history
  • Loading branch information
creasty committed Sep 1, 2023
1 parent e753678 commit 296af3d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions nvim/init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,18 @@ if dein#is_available('coc.nvim') &&
return ''
endfunction

function! s:super_iv_c_s_c_c() abort
if s:is_copilot_suggested()
call copilot#Dismiss()
return ''
endif
if get(b:, 'coc_snippet_active', v:false)
call CocAction('snippetCancel')
return ''
endif
return ''
endfunction

inoremap <Plug>(completion-cancel) <C-e>
inoremap <Plug>(completion-accept) <C-y>
inoremap <Plug>(coc-enter) <C-g>u<CR><C-r>=coc#on_enter()<CR>
Expand All @@ -644,6 +656,8 @@ if dein#is_available('coc.nvim') &&
vmap <silent><expr> <C-s><C-p> <SID>super_iv_c_s_c_p()
imap <silent><expr> <C-s><C-n> <SID>super_iv_c_s_c_n()
vmap <silent><expr> <C-s><C-n> <SID>super_iv_c_s_c_n()
imap <silent><expr> <C-s><C-c> <SID>super_iv_c_s_c_c()
vmap <silent><expr> <C-s><C-c> <SID>super_iv_c_s_c_c()
endfunction

function! s:auto_dismiss_copilot(float) abort
Expand Down

0 comments on commit 296af3d

Please sign in to comment.