How to use Tab for both snippet jumping and popup navigation in coc.nvim

I have a question on coc.nvim issue but the author reply me with the message:

Learn viml, the plugin already provided what you need.

I’m just a normal user who wants to use the plugin and wants to ask the question for help.

Does anyone have an idea for my issues? Thanks in advance for you help.

are you try to replace coc#select_confirn with <c-n> or some thing similar coc#gonext :smile: .
if it is not working you need create a custom mapping function it will return empty if pumvisible then call feedkey <c-n>.

ofcourse like the maintainer say you need learn viml :slight_smile:

Thanks, but it just works for with it didn’t work.

Here is my config, can you fix it for me, I’m not familiar with VimL.

"Completion settings
"Use <tab> for trigger completion and navigate to the next complete item
inoremap <silent><expr> <Tab>
  \ pumvisible() ? "\<C-n>" :
  \ coc#expandableOrJumpable() ?
  \ "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
  \ <SID>check_back_space() ? "\<Tab>" :
  \ coc#refresh()

inoremap <silent><expr> <S-Tab>
  \ pumvisible() ? "\<C-p>" :
  \ coc#expandableOrJumpable() ?
  \ "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-pre',''])\<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

"Select the first completion item and confirm the completion when no item has been selected:
inoremap <silent><expr> <CR> pumvisible() ? coc#_select_confirm()
    \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

let g:coc_snippet_next = '<Tab>'
let g:coc_snippet_prev = '<S-Tab>'

bandicam 2022-04-06 16-40-42-377