coq_nvim icon indicating copy to clipboard operation
coq_nvim copied to clipboard

[Question] Have problem when select completion item

Open hiberabyss opened this issue 4 years ago • 9 comments

Is it possible to auto fill the item in line when use <c-n> or <c-p>? Currently, the content keep unchanged and has the notation like < item >.

image

And following mapping seems not work:

ino <silent> <expr> <CR>  pumvisible() ? (complete_info(["selected"]).selected == -1 ? "\<C-e><CR>" : "\<C-y>") : "\<CR>"

Will get following line when press <cr> if the map added.

image

My neovim version: NVIM v0.5.1 Build type: Release LuaJIT 2.1.0-beta3

hiberabyss avatar Nov 01 '21 13:11 hiberabyss

Is it possible to auto fill the item in line when use <c-n> or <c-p>? Currently, the content keep unchanged and has the notation like < item >.

Sounds like a duplicate of #90.

And following mapping seems not work:

ino <silent> <expr> <CR>  pumvisible() ? (complete_info(["selected"]).selected == -1 ? "\<C-e><CR>" : "\<C-y>") : "\<CR>"

Maybe you made a typo when creating the mapping.

zeertzjq avatar Nov 01 '21 23:11 zeertzjq

Is it possible to auto fill the item in line when use <c-n> or <c-p>? Currently, the content keep unchanged and has the notation like < item >.

Sounds like a duplicate of #90.

And following mapping seems not work:

ino <silent> <expr> <CR>  pumvisible() ? (complete_info(["selected"]).selected == -1 ? "\<C-e><CR>" : "\<C-y>") : "\<CR>"

Copy

Maybe you made a typo when creating the mapping.

Have same problem when set map as KEYBIND.md said:

ino <silent><expr> <CR>    pumvisible() ? (complete_info().selected == -1 ? "\<C-e><CR>" : "\<C-y>") : "\<CR>"

hiberabyss avatar Nov 02 '21 02:11 hiberabyss

What does :imap <CR> print?

zeertzjq avatar Nov 02 '21 02:11 zeertzjq

image

hiberabyss avatar Nov 02 '21 02:11 hiberabyss

Does this work for you?

let g:endwise_no_mappings = 1
imap <silent><expr> <CR> (pumvisible() ? (complete_info().selected == -1 ? "\<C-e><CR>" : "\<C-y>") : "\<CR>") .. "\<Plug>DiscretionaryEnd"

zeertzjq avatar Nov 02 '21 02:11 zeertzjq

Or this:

let g:endwise_no_mappings = 1
imap <silent><expr> <CR> pumvisible() ? (complete_info().selected == -1 ? "\<C-e>\<CR>\<Plug>DiscretionaryEnd" : "\<C-y>") : "\<CR>\<Plug>DiscretionaryEnd"

zeertzjq avatar Nov 02 '21 02:11 zeertzjq

Sounds like tpope/vim-endwise#109.

Working after disable endwise plugin. Thanks!

hiberabyss avatar Nov 02 '21 03:11 hiberabyss

As per the suggested workaround there, perhaps Coq could make it easier for plugins such as vim-closer/vim-endwise to extend its mappings by not defining them as expr mappings? Something along the lines of:

inoremap <expr> <plug>CustomCoqCR pumvisible() ? (complete_info(['selected']).selected == -1 ? '\<c-e>\<cr>' : '\<c-y>') : '\<cr>'
imap <cr> <plug>CustomCoqCR

Then the <cr> mapping is no longer an expr and vim-closer/vim-endwise don't break it when expanding it.

laomaiweng avatar Feb 02 '22 23:02 laomaiweng