1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 05:20:04 +08:00

Merge branch 'autocomplete' into dev

This commit is contained in:
wsdjeg 2017-08-26 22:33:32 +00:00
commit a4c3fb9a2d
2 changed files with 34 additions and 11 deletions

View File

@ -1,6 +1,11 @@
language: python
sudo: false
notifications:
slack:
on_success: never
on_failure: never
cache:
pip: true

View File

@ -73,15 +73,28 @@ function! SpaceVim#layers#autocomplete#config() abort
\ '('
"mapping
imap <silent><expr><TAB> SpaceVim#mapping#tab()
imap <silent><expr><S-TAB> SpaceVim#mapping#shift_tab()
imap <silent><expr><CR> SpaceVim#mapping#enter()
smap <expr><TAB>
\ neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" :
\ (complete_parameter#jumpable(1) ?
\ "\<plug>(complete_parameter#goto_next_parameter)" :
\ "\<TAB>")
if s:tab_key_behavior ==# 'smart'
imap <silent><expr><TAB> SpaceVim#mapping#tab()
smap <expr><TAB>
\ neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" :
\ (complete_parameter#jumpable(1) ?
\ "\<plug>(complete_parameter#goto_next_parameter)" :
\ "\<TAB>")
imap <silent><expr><S-TAB> SpaceVim#mapping#shift_tab()
elseif s:tab_key_behavior ==# 'complete'
inoremap <expr> <Tab> pumvisible() ? "\<C-y>" : "\<C-n>"
elseif s:tab_key_behavior ==# 'cycle'
inoremap <expr> <Tab> pumvisible() ? "\<Down>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<Up>" : ""
elseif s:tab_key_behavior ==# 'nil'
endif
if s:return_key_behavior ==# 'smart'
imap <silent><expr><CR> SpaceVim#mapping#enter()
elseif s:return_key_behavior ==# 'complete'
imap <silent><expr><CR> pumvisible() ? "\<C-y>" : "\<CR>"
elseif s:return_key_behavior ==# 'nil'
endif
inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
@ -91,10 +104,15 @@ function! SpaceVim#layers#autocomplete#config() abort
imap <expr> <M-/>
\ neosnippet#expandable() ?
\ "\<Plug>(neosnippet_expand)" : ""
call SpaceVim#mapping#space#def('nnoremap', ['i', 's'], 'Unite neosnippet', 'insert sneppets', 1)
call SpaceVim#mapping#space#def('nnoremap', ['i', 's'], 'Unite neosnippet', 'insert sneppets', 1)
endfunction
function! SpaceVim#layers#autocomplete#set_variable(var)
let s:return_key_behavior = 'smart'
let s:tab_key_behavior = 'smart'
let s:key_sequence = 'nil'
let s:key_sequence_delay = 0.1
function! SpaceVim#layers#autocomplete#set_variable(var) abort
let s:return_key_behavior = get(a:var,
\ 'auto-completion-return-key-behavior',