From ed142f75309a9811a038d422badfd691a2ea3d91 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 5 Nov 2017 13:44:33 +0800 Subject: [PATCH] Fix multiple cursor --- autoload/SpaceVim/layers/edit.vim | 2 +- config/plugins/neocomplete.vim | 11 ------- config/plugins/vim-multiple-cursors.vim | 39 +++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 12 deletions(-) create mode 100644 config/plugins/vim-multiple-cursors.vim diff --git a/autoload/SpaceVim/layers/edit.vim b/autoload/SpaceVim/layers/edit.vim index 8ba8ea8f0..376d7cb78 100644 --- a/autoload/SpaceVim/layers/edit.vim +++ b/autoload/SpaceVim/layers/edit.vim @@ -8,7 +8,7 @@ function! SpaceVim#layers#edit#plugins() abort \ ['tpope/vim-surround'], \ ['tpope/vim-repeat'], \ ['junegunn/vim-emoji'], - \ ['terryma/vim-multiple-cursors'], + \ ['terryma/vim-multiple-cursors', { 'loadconf' : 1}], \ ['terryma/vim-expand-region', { 'loadconf' : 1}], \ ['kana/vim-textobj-user'], \ ['kana/vim-textobj-indent'], diff --git a/config/plugins/neocomplete.vim b/config/plugins/neocomplete.vim index a69367d22..c55defc05 100644 --- a/config/plugins/neocomplete.vim +++ b/config/plugins/neocomplete.vim @@ -68,14 +68,3 @@ inoremap neocomplete#smart_close_popup()."\" inoremap neocomplete#smart_close_popup()."\" inoremap neocomplete#close_popup() inoremap neocomplete#cancel_popup() - -" Called once right before you start selecting multiple cursors -function! Multiple_cursors_before() - NeoCompleteLock -endfunction - -" Called once only when the multiple selection is canceled (default ) -function! Multiple_cursors_after() - NeoCompleteUnlock -endfunction -" vim:set et sw=2 cc=80: diff --git a/config/plugins/vim-multiple-cursors.vim b/config/plugins/vim-multiple-cursors.vim new file mode 100644 index 000000000..5d3bcce75 --- /dev/null +++ b/config/plugins/vim-multiple-cursors.vim @@ -0,0 +1,39 @@ +if g:spacevim_autocomplete_method ==# 'ycm' + function! s:disable_autocomplete() abort + + endfunction + function! s:enable_autocomplete() abort + + endfunction +elseif g:spacevim_autocomplete_method ==# 'neocomplete' + function! s:disable_autocomplete() abort + NeoCompleteLock + endfunction + function! s:enable_autocomplete() abort + NeoCompleteUnlock + endfunction +elseif g:spacevim_autocomplete_method ==# 'neocomplcache' "{{{ + function! s:disable_autocomplete() abort + + endfunction + function! s:enable_autocomplete() abort + + endfunction +elseif g:spacevim_autocomplete_method ==# 'deoplete' + function! s:disable_autocomplete() abort + call deoplete#disable() + endfunction + function! s:enable_autocomplete() abort + call deoplete#enable() + endfunction +endif +" Called once right before you start selecting multiple cursors +function! Multiple_cursors_before() + call s:disable_autocomplete() +endfunction + +" Called once only when the multiple selection is canceled (default ) +function! Multiple_cursors_after() + call s:enable_autocomplete() +endfunction +" vim:set et sw=2 cc=80: