mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 05:30:05 +08:00
Merge pull request #328 from SpaceVim/complete_pairs
Add complete pairs feature
This commit is contained in:
commit
7d0e0306ba
@ -159,13 +159,14 @@ function! SpaceVim#default#SetMappings() abort
|
||||
|
||||
"mapping
|
||||
imap <silent><expr><TAB> SpaceVim#mapping#tab()
|
||||
imap <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
|
||||
imap <silent><expr><S-TAB> SpaceVim#mapping#shift_tab()
|
||||
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
|
||||
inoremap <silent><expr><CR> SpaceVim#mapping#enter()
|
||||
inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
|
||||
inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
|
||||
inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>"
|
||||
inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>"
|
||||
imap <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
|
||||
smap <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
|
||||
" Save a file with sudo
|
||||
" http://forrst.com/posts/Use_w_to_sudo_write_a_file_with_Vim-uAN
|
||||
|
@ -21,42 +21,46 @@
|
||||
|
||||
|
||||
function! SpaceVim#layers#autocomplete#plugins() abort
|
||||
let plugins = [
|
||||
\ ['honza/vim-snippets', {'on_i' : 1, 'loadconf_before' : 1}],
|
||||
\ ['Shougo/neco-syntax', { 'on_i' : 1}],
|
||||
\ ['ujihisa/neco-look', { 'on_i' : 1}],
|
||||
\ ['Shougo/context_filetype.vim', { 'on_i' : 1}],
|
||||
\ ['Shougo/neoinclude.vim', { 'on_i' : 1}],
|
||||
\ ['Shougo/neosnippet-snippets', { 'merged' : 0}],
|
||||
\ ['Shougo/neopairs.vim', { 'on_i' : 1}],
|
||||
\ ]
|
||||
if g:spacevim_autocomplete_method ==# 'ycm'
|
||||
call add(plugins, ['SirVer/ultisnips', {'loadconf_before' : 1, 'merged' : 0}])
|
||||
call add(plugins, ['ervandew/supertab', {'loadconf_before' : 1, 'merged' : 0}])
|
||||
call add(plugins, ['Valloric/YouCompleteMe', {'loadconf_before' : 1, 'merged' : 0}])
|
||||
elseif g:spacevim_autocomplete_method ==# 'neocomplete' "{{{
|
||||
call add(plugins, ['Shougo/neocomplete', {
|
||||
\ 'on_i' : 1,
|
||||
\ 'loadconf' : 1,
|
||||
\ }])
|
||||
elseif g:spacevim_autocomplete_method ==# 'neocomplcache' "{{{
|
||||
call add(plugins, ['Shougo/neocomplcache.vim', {
|
||||
\ 'on_i' : 1,
|
||||
\ 'loadconf' : 1,
|
||||
\ }])
|
||||
elseif g:spacevim_autocomplete_method ==# 'deoplete'
|
||||
call add(plugins, ['Shougo/deoplete.nvim', {
|
||||
\ 'on_i' : 1,
|
||||
\ 'loadconf' : 1,
|
||||
\ }])
|
||||
endif
|
||||
return plugins
|
||||
let plugins = [
|
||||
\ ['honza/vim-snippets', { 'on_i' : 1, 'loadconf_before' : 1}],
|
||||
\ ['Shougo/neco-syntax', { 'on_i' : 1}],
|
||||
\ ['ujihisa/neco-look', { 'on_i' : 1}],
|
||||
\ ['Shougo/context_filetype.vim', { 'on_i' : 1}],
|
||||
\ ['Shougo/neoinclude.vim', { 'on_i' : 1}],
|
||||
\ ['Shougo/neosnippet-snippets', { 'merged' : 0}],
|
||||
\ ['Shougo/neopairs.vim', { 'on_i' : 1}],
|
||||
\ ['Raimondi/delimitMate', { 'merged' : 0}],
|
||||
\ ]
|
||||
if g:spacevim_autocomplete_method ==# 'ycm'
|
||||
call add(plugins, ['SirVer/ultisnips', { 'loadconf_before' : 1, 'merged' : 0}])
|
||||
call add(plugins, ['ervandew/supertab', { 'loadconf_before' : 1, 'merged' : 0}])
|
||||
call add(plugins, ['Valloric/YouCompleteMe', { 'loadconf_before' : 1, 'merged' : 0}])
|
||||
elseif g:spacevim_autocomplete_method ==# 'neocomplete'
|
||||
call add(plugins, ['Shougo/neocomplete', {
|
||||
\ 'on_i' : 1,
|
||||
\ 'loadconf' : 1,
|
||||
\ }])
|
||||
elseif g:spacevim_autocomplete_method ==# 'neocomplcache' "{{{
|
||||
call add(plugins, ['Shougo/neocomplcache.vim', {
|
||||
\ 'on_i' : 1,
|
||||
\ 'loadconf' : 1,
|
||||
\ }])
|
||||
elseif g:spacevim_autocomplete_method ==# 'deoplete'
|
||||
call add(plugins, ['Shougo/deoplete.nvim', {
|
||||
\ 'on_i' : 1,
|
||||
\ 'loadconf' : 1,
|
||||
\ }])
|
||||
endif
|
||||
return plugins
|
||||
endfunction
|
||||
|
||||
|
||||
function SpaceVim#layers#autocomplete#config()
|
||||
if g:spacevim_autocomplete_method ==# 'ycm'
|
||||
iunmap <S-TAB>
|
||||
sunmap <S-TAB>
|
||||
endif
|
||||
function! SpaceVim#layers#autocomplete#config() abort
|
||||
if g:spacevim_autocomplete_method ==# 'ycm'
|
||||
sunmap <S-TAB>
|
||||
iunmap <S-TAB>
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
" vim:set et sw=2 cc=80:
|
||||
|
@ -16,6 +16,10 @@ function! SpaceVim#mapping#def(type,key,value,desc,...) abort
|
||||
call add(g:unite_source_menu_menus.CustomKeyMaps.command_candidates, [description,cmd])
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#mapping#shift_tab() abort
|
||||
return pumvisible() ? "\<C-p>" : "\<Plug>delimitMateS-Tab"
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#mapping#tab() abort
|
||||
if getline('.')[col('.')-2] ==# '{'&& pumvisible()
|
||||
return "\<C-n>"
|
||||
|
Loading…
Reference in New Issue
Block a user