By following this guide, I could get a simple snippet working.
" vim source for emails
function! coc#source#email#init() abort
return {
\ 'priority': 9,
\ 'shortcut': 'Email',
\ 'triggerCharacters': ['@']
\}
endfunction
function! coc#source#email#complete(opt, cb) abort
let items = ['foo@gmail.com', 'bar@yahoo.com']
call a:cb(items)
endfunction
But I want when user types something like afc
and hit enter in the correct item in the menu. What coc.nvim
should enter to the buffer is following. .
() => {
}
I don't know what this triggerCharacters
option is but it certainly not the characters I should enter in the buffer to get the auto completion menu open because it's not showing up in the menu.
How can I do this?