spf13-vim
spf13-vim copied to clipboard
After 'terryma/vim-multiple-cursors' into insert mode, `<Plug>(neocomplete_start_auto_complete)`
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)
I got the same situation.
This happens for me when I edit a .jsx (React) file.
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
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
To help people via search engine, I would only get:
<Plug>_
when trying to insert code with Deoplete.
Thank you @tpai and @ChinLeung
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 What do you mean by it's not working? Any errors? Or deoplete just kept showing up?
@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.
I had the same issue! @hamidraza fix helped. So thanks to you both. Nice done
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!