Closed awelormro closed 1 year ago
Closing the popup menu by pressing Enter is Vim's default behaviour. Can you elaborate on what you are trying to achieve?
The fact to not create a new line when enter key is pressed inside the popup menu, just close when the popup menu is created, it is done when it's accessed via up-down keys, but when tab/Shift-tab is pressed, it creates a new line, my current settings are:
set completeopt+=noselect
set completeopt+=menuone,preview
set shortmess+=c " Shut off completion messages
set belloff+=ctrlg " Add only if Vim beeps during completion
let g:mucomplete#enable_auto_at_startup = 1
let g:mucomplete#completion_delay = 1
" Define default completion chain
let g:mucomplete#chains = { 'default':
\ [ 'ulti', 'omni','keyn','keyp','tags','spel','path','line'] }
snoremap <silent> <tab> <Esc>:call UltiSnips#ExpandSnippetOrJump()<cr>
let g:mucomplete#can_complete = {}
let g:mucomplete#can_complete.tex = { 'omni': { t -> t =~# g:vimtex#re#neocomplete . '$' } }
let g:mucomplete#ultisnips#match_at_start = 1
``
So, you want Enter to just close the popup menu, but never start a new line? How about this:
inoremap <expr> <cr> pumvisible() ? "<c-y>" : "<cr>"
Does this help?
Didn't help u.u
Does your issue happen in every buffer, regardless of filetype, or just in TeX buffers? It seems that you are using Neocomplete in TeX buffers: maybe there is some conflict…
Nope, it happens in every buffer, I'm using vanilla vim and I've been testing in vimscript, python and js files
Found a solution using a timer to execute the cr keymap half a second after vim starts, it follows:
function DelayedSetVariables(timer)
inoremap <expr> <cr> ((pumvisible())?("\<C-y>"):("\<cr>"))
endfunction
let timer=timer_start(500,'DelayedSetVariables')
Hello, and thank you for the amazing plugin! Just a curious question, Is there a way to close and confirm the selection from the popup menu with Cr in insert mode?