From e6df9f8f07d0a9f99ce355c52ee8ccd33fc3fd81 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 1 Aug 2017 06:51:11 +0800 Subject: [PATCH] Fix #762 --- autoload/SpaceVim/layers/autocomplete.vim | 23 +++++++------ autoload/SpaceVim/mapping.vim | 39 ++--------------------- autoload/SpaceVim/mapping/tab.vim | 27 +++++++--------- 3 files changed, 24 insertions(+), 65 deletions(-) diff --git a/autoload/SpaceVim/layers/autocomplete.vim b/autoload/SpaceVim/layers/autocomplete.vim index 2f63429cb..64eeec865 100644 --- a/autoload/SpaceVim/layers/autocomplete.vim +++ b/autoload/SpaceVim/layers/autocomplete.vim @@ -65,21 +65,20 @@ endfunction function! SpaceVim#layers#autocomplete#config() abort - if g:spacevim_autocomplete_method ==# 'ycm' - sunmap - iunmap - endif let g:delimitMate_matchpairs = '[:],{:},<:>' inoremap ( complete_parameter#pre_complete("()") - "mapping - imap SpaceVim#mapping#tab#i_tab() - imap pumvisible() ? "\" : "" - imap SpaceVim#mapping#shift_tab() - smap neosnippet#expandable_or_jumpable() ? "\(neosnippet_expand_or_jump)" : (complete_parameter#jumpable(1) ? "\(complete_parameter#goto_next_parameter)" : "\") - imap SpaceVim#mapping#enter#i_enter() - smap pumvisible() ? "\" : "" - + "mapping + imap SpaceVim#mapping#tab() + imap SpaceVim#mapping#shift_tab() + imap SpaceVim#mapping#enter() + smap + \ neosnippet#expandable_or_jumpable() ? + \ "\(neosnippet_expand_or_jump)" : + \ (complete_parameter#jumpable(1) ? + \ "\(complete_parameter#goto_next_parameter)" : + \ "\") + inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\\\" : "\" diff --git a/autoload/SpaceVim/mapping.vim b/autoload/SpaceVim/mapping.vim index b7a593036..a5a2d7b84 100644 --- a/autoload/SpaceVim/mapping.vim +++ b/autoload/SpaceVim/mapping.vim @@ -80,46 +80,11 @@ function! SpaceVim#mapping#shift_tab() abort endfunction function! SpaceVim#mapping#tab() abort - if getline('.')[col('.')-2] ==# '{'&& pumvisible() - return "\" - endif - if index(g:spacevim_plugin_groups, 'autocomplete') != -1 - if neosnippet#expandable() && getline('.')[col('.')-2] ==# '(' && !pumvisible() - return "\(neosnippet_expand)" - elseif neosnippet#jumpable() - \ && getline('.')[col('.')-2] ==# '(' && !pumvisible() - \ && !neosnippet#expandable() - return "\(neosnippet_jump)" - elseif neosnippet#expandable_or_jumpable() && getline('.')[col('.')-2] !=#'(' - return "\(neosnippet_expand_or_jump)" - elseif pumvisible() - return "\" - elseif complete_parameter#jumpable(1) - return "\(complete_parameter#goto_next_parameter)" - else - return "\" - endif - elseif pumvisible() - return "\" - else - return "\" - endif + return SpaceVim#mapping#tab#i_tab() endfunction function! SpaceVim#mapping#enter() abort - if pumvisible() - if getline('.')[col('.') - 2]==# '{' - return "\" - elseif g:spacevim_autocomplete_method ==# 'neocomplete'||g:spacevim_autocomplete_method ==# 'deoplete' - return "\" - else - return "\a" - endif - elseif getline('.')[col('.') - 2]==#'{'&&getline('.')[col('.')-1]==#'}' - return "\\ko" - else - return "\" - endif + return SpaceVim#mapping#enter#i_enter() endfunction function! SpaceVim#mapping#gd() abort diff --git a/autoload/SpaceVim/mapping/tab.vim b/autoload/SpaceVim/mapping/tab.vim index 18e3fdabe..cd3112099 100644 --- a/autoload/SpaceVim/mapping/tab.vim +++ b/autoload/SpaceVim/mapping/tab.vim @@ -3,24 +3,18 @@ if g:spacevim_snippet_engine ==# 'neosnippet' if getline('.')[col('.')-2] ==# '{'&& pumvisible() return "\" endif - if index(g:spacevim_plugin_groups, 'autocomplete') != -1 - if neosnippet#expandable() && getline('.')[col('.')-2] ==# '(' && !pumvisible() - return "\(neosnippet_expand)" - elseif neosnippet#jumpable() - \ && getline('.')[col('.')-2] ==# '(' && !pumvisible() - \ && !neosnippet#expandable() - return "\(neosnippet_jump)" - elseif neosnippet#expandable_or_jumpable() && getline('.')[col('.')-2] !=#'(' - return "\(neosnippet_expand_or_jump)" - elseif pumvisible() - return "\" - elseif complete_parameter#jumpable(1) - return "\(complete_parameter#goto_next_parameter)" - else - return "\" - endif + if neosnippet#expandable() && getline('.')[col('.')-2] ==# '(' && !pumvisible() + return "\(neosnippet_expand)" + elseif neosnippet#jumpable() + \ && getline('.')[col('.')-2] ==# '(' && !pumvisible() + \ && !neosnippet#expandable() + return "\(neosnippet_jump)" + elseif neosnippet#expandable_or_jumpable() && getline('.')[col('.')-2] !=#'(' + return "\(neosnippet_expand_or_jump)" elseif pumvisible() return "\" + elseif complete_parameter#jumpable(1) && getline('.')[col('.')-2] !=# ')' + return "\(complete_parameter#goto_next_parameter)" else return "\" endif @@ -30,4 +24,5 @@ elseif g:spacevim_snippet_engine ==# 'ultisnips' return "\" endfunction endif + " vim:set et sw=2 cc=80: