Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is visual placeholder working? #8

Closed
purpleP opened this issue Jan 29, 2019 · 8 comments
Closed

Is visual placeholder working? #8

purpleP opened this issue Jan 29, 2019 · 8 comments

Comments

@purpleP
Copy link

purpleP commented Jan 29, 2019

I do vmap <tab> <Plug>(coc-snippets-expand), and select text visually, and then trigger the snippet. But visual placeholder is empty.

@purpleP purpleP closed this as completed Jan 29, 2019
@jsrojoo
Copy link

jsrojoo commented Oct 2, 2019

Hi @purpleP, did you get this to work? I am also experiencing the same issue.

@chemzqm
Copy link
Member

chemzqm commented Oct 2, 2019

Make sure your keymap is expected

@jsrojoo
Copy link

jsrojoo commented Oct 2, 2019

This is the mapping I have :

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 = '<tab>'

But it does not seem to work. Do I need to add the default mapping as well to make the visual placeholder work?

@chemzqm
Copy link
Member

chemzqm commented Oct 2, 2019

You keymap is only used for expand & jump while g:coc_snippet_next would have higher priority.
You have to configure and invoke keymap for visual select the text first, please read Readme.

@jsrojoo
Copy link

jsrojoo commented Oct 2, 2019 via email

@chemzqm
Copy link
Member

chemzqm commented Oct 2, 2019

then hitting the default mapping lets me go to insert mode.

It's not default, you need add it to your vimrc.

@jsrojoo
Copy link

jsrojoo commented Oct 2, 2019 via email

@chemzqm
Copy link
Member

chemzqm commented Oct 2, 2019

Don't know, can't reproduce, you can debug the plugin in chrome https://github.com/neoclide/coc.nvim/wiki/Debug-coc.nvim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants