neoclide / coc-pairs

Basic auto pairs extension of coc.nvim
297 stars 14 forks source link

on_enter CHANGE <CR> TO CONFIRM COMELITION #85

Closed NEX-S closed 2 years ago

NEX-S commented 2 years ago

原先我设置补全确认为 TAB, CR 跳转下一行。下载了coc-pairs 后为解决缩进问题,我开启了

inoremap <silent> <expr> <cr> pumvisible() ? coc#_select_confirm()
            \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

然后原来的 CR 从换行变成确认补全了,想请教一下赵师傅要怎么更改,不胜感激。

附上我的COC配置

...
inoremap <silent> <expr> <tab>
      \ pumvisible() ? coc#_select_confirm() :
      \ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
      \ <SID>check_back_space() ? "\<TAB>" :
      \ coc#refresh()

function! s:check_back_space() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction

let g:coc_snippet_next = '<A-j>'
let g:coc_snippet_prev = '<A-k>
...
chemzqm commented 2 years ago

你能看文档?