spf13-vim icon indicating copy to clipboard operation
spf13-vim copied to clipboard

After 'terryma/vim-multiple-cursors' into insert mode, `<Plug>(neocomplete_start_auto_complete)`

Open viktor-yang opened this issue 7 years ago • 10 comments

After I use 'vim-multiple-cursors', I change into insert mode and input something. And it become slow and add this:

<Plug>(neocomplete_start_auto_complete)

viktor-yang avatar Mar 25 '17 17:03 viktor-yang

I got the same situation.

tpai avatar May 08 '17 01:05 tpai

This happens for me when I edit a .jsx (React) file.

neocomplete_start_auto_complete

nzbart avatar Aug 22 '17 19:08 nzbart

Found the solution, simply put these code into vimrc will fix.

" Called once right before you start selecting multiple cursors
function! Multiple_cursors_before()
  if exists(':NeoCompleteLock')==2
    exe 'NeoCompleteLock'
  endif
endfunction

" Called once only when the multiple selection is canceled (default <Esc>)
function! Multiple_cursors_after()
  if exists(':NeoCompleteUnlock')==2
    exe 'NeoCompleteUnlock'
  endif
endfunction

Reference: vim-multiple-cursors

tpai avatar Aug 23 '17 01:08 tpai

For those who needs a solution that supports deoplete:

" Disable Deoplete when selecting multiple cursors starts
function! Multiple_cursors_before()
    if exists('*deoplete#disable')
        exe 'call deoplete#disable()'
    elseif exists(':NeoCompleteLock') == 2
        exe 'NeoCompleteLock'
    endif
endfunction

" Enable Deoplete when selecting multiple cursors ends
function! Multiple_cursors_after()
    if exists('*deoplete#enable')
        exe 'call deoplete#enable()'
    elseif exists(':NeoCompleteUnlock') == 2
        exe 'NeoCompleteUnlock'
    endif
endfunction

Update

Looks like some people are having issues with deoplete#enable() and has to use deoplete#toggle() instead. So here's the updated version:

" Disable Deoplete when selecting multiple cursors starts
function! Multiple_cursors_before()
    if exists('*deoplete#disable')
        exe 'call deoplete#disable()'
    elseif exists(':NeoCompleteLock') == 2
        exe 'NeoCompleteLock'
    endif
endfunction

" Enable Deoplete when selecting multiple cursors ends
function! Multiple_cursors_after()
    if exists('*deoplete#toggle')
        exe 'call deoplete#toggle()'
    elseif exists(':NeoCompleteUnlock') == 2
        exe 'NeoCompleteUnlock'
    endif
endfunction

chinleung avatar Dec 13 '17 21:12 chinleung

To help people via search engine, I would only get: <Plug>_ when trying to insert code with Deoplete.

Thank you @tpai and @ChinLeung

Dbz avatar Feb 02 '18 21:02 Dbz

in @chinleung code I had to replace exe 'call deoplete#disable()' or exe 'call deoplete#enable()' to exe 'call deoplete#toggle()'

after deoplete gets disabled, call deoplete#enable() was not working for me.

hamidraza avatar Feb 27 '18 02:02 hamidraza

@hamidraza What do you mean by it's not working? Any errors? Or deoplete just kept showing up?

chinleung avatar Feb 27 '18 14:02 chinleung

@chinleung Once deoplete gets disabled, ‘deoplete#enable()’ was unable to enable is back, means Autocompletion was permanently disabled. I didn’t get any error in VIM.

hamidraza avatar Mar 01 '18 04:03 hamidraza

I had the same issue! @hamidraza fix helped. So thanks to you both. Nice done

martinbergpetersen avatar Mar 18 '18 10:03 martinbergpetersen

Same here, so copy pasting the full solution here again for those reading the thread too fast:

" Disable Deoplete when selecting multiple cursors starts
function! Multiple_cursors_before()
    if exists('*deoplete#disable')
        exe 'call deoplete#disable()'
    elseif exists(':NeoCompleteLock') == 2
        exe 'NeoCompleteLock'
    endif
endfunction

" Enable Deoplete when selecting multiple cursors ends
function! Multiple_cursors_after()
    if exists('*deoplete#toggle')
        exe 'call deoplete#toggle()'
    elseif exists(':NeoCompleteUnlock') == 2
        exe 'NeoCompleteUnlock'
    endif
endfunction

Thanks!

charlax avatar Apr 05 '18 13:04 charlax