Closed Ynoop closed 4 months ago
How do you setup your <tab>
mappings? Check :verbose imap <tab>
.
https://github.com/neoclide/coc-snippets 默认是 <C-j>
跳转 snippet placeholder. 可以设置使用 <tab>
来跳转 https://github.com/neoclide/coc.nvim/wiki/Using-snippets#configure-snippets-workflow
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" coc-nvim config
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" use <tab> to trigger completion and navigate to the next complete item
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
inoremap <silent><expr> <Tab>
\ coc#pum#visible() ? coc#pum#next(1) :
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
let g:coc_snippet_next = '<Tab>'
上面的配置正确吗, 我的预期是用tab触发补全,再按tab进行补全条目选择。选择好了之后,再按tab可以进行placeholder的跳转。
现在我对coc.nvim的readme中的下面部分:
" Use tab for trigger completion with characters ahead and navigate
" NOTE: There's always complete item selected by default, you may want to enable
" no select by `"suggest.noselect": true` in your configuration file
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
以及coc-snippets的下面部分
inoremap <silent><expr> <TAB>
\ pumvisible() ? coc#_select_confirm() :
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ CheckBackSpace() ? "\<TAB>" :
\ coc#refresh()
function! CheckBackSpace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
let g:coc_snippet_next = '<tab>'
不理解,该怎么配置呢
我使用coc.nvim推荐的配置+friendly-snippets,当补全内容确认以后,无法用table切换需要输入的内容。