Closed ghost closed 7 years ago
lexima.vim sends <C-y>
before pressing <CR>
to close complete popup. (See :h omplete_CTRL-Y
.)
I think neovim's <C-y>
doesn't work correctly.
Please try below.
Plug 'cohama/lexima.vim'
for minimal.init.vim.<C-y>
instead of <CR>
.I tried with normal Vim (version 8.0.23) with neocomplete and nothing happend.
C-y accepts selected completion and closes the popup. That is without lexima installed.
I have found a work around.
Please add below in your minimal.init.nvim
and please re-try.
let g:lexima_no_default_rules = 1
call lexima#set_default_rules()
call lexima#insmode#map_hook('before', '<CR>', "<C-]><Space><BS>")
If it is good, I will merge that change into the master.
With
let g:lexima_no_default_rules = 1
call plug#begin('~/.config/nvim/minimal-plugged')
Plug 'Shougo/deoplete.nvim'
Plug 'cohama/lexima.vim'
call plug#end()
call lexima#set_default_rules()
call lexima#insmode#map_hook('before', '<CR>', "<C-]><Space><BS>")
let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_refresh_always = 1
let g:deoplete#enable_ignore_case = 1
let g:deoplete#enable_smart_case = 1
let g:deoplete#enable_camel_case = 1
let g:deoplete#file#enable_buffer_path = 1
call deoplete#custom#set('_', 'matchers', ['matcher_full_fuzzy'])
set omnifunc=syntaxcomplete#Complete
set completeopt=longest,menuone,preview,noinsert
CR enters new line without accepting completion at all. It leaves whatever was inserted in the first place.
Is it OK?
Oh, no, sorry, it should accept selected completion, it doesn't with configuration you provided.
Sorry, I misunderstood. What you want is not insert new line but accept completion.
Please try below. (Add to the original min.init.nvim
)
let g:lexima_no_default_rules = 1
call lexima#set_default_rules()
imap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>"
This works exactly how I want it. Is it something that should be configured by user or do you want to merge that into lexima?
EDIT: All lines you provided are required in my full init.vim, not for minimal one though.
Ok thanks. I will merge this change for neovim.
These two lines are necessary to override lexima's default mapping. (but it depends on plugin manager you use)
imap
is also necessary. If you use inoremap
, lexima's <CR>
features are no longer available.
Thank you very much for looking into this!
Minimal config:
Steps to reproduce:
nvim -u minimal.init.vim
.Outcome: Upon completion accepted by cursor is moved to new line.
Expected outcome: Completion should happen without entering new line.
Both lexima and deoplete are latest versions. Neovim is 0.1.5.
Please see gif demonstrating the issue: