mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-09 16:10: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
|
"mapping
|
||||||
imap <silent><expr><TAB> SpaceVim#mapping#tab()
|
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>"
|
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
|
||||||
inoremap <silent><expr><CR> SpaceVim#mapping#enter()
|
inoremap <silent><expr><CR> SpaceVim#mapping#enter()
|
||||||
inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
|
inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
|
||||||
inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
|
inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
|
||||||
inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>"
|
inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>"
|
||||||
inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>"
|
inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>"
|
||||||
imap <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
|
|
||||||
smap <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
|
smap <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
|
||||||
" Save a file with sudo
|
" Save a file with sudo
|
||||||
" http://forrst.com/posts/Use_w_to_sudo_write_a_file_with_Vim-uAN
|
" http://forrst.com/posts/Use_w_to_sudo_write_a_file_with_Vim-uAN
|
||||||
|
@ -21,42 +21,46 @@
|
|||||||
|
|
||||||
|
|
||||||
function! SpaceVim#layers#autocomplete#plugins() abort
|
function! SpaceVim#layers#autocomplete#plugins() abort
|
||||||
let plugins = [
|
let plugins = [
|
||||||
\ ['honza/vim-snippets', {'on_i' : 1, 'loadconf_before' : 1}],
|
\ ['honza/vim-snippets', { 'on_i' : 1, 'loadconf_before' : 1}],
|
||||||
\ ['Shougo/neco-syntax', { 'on_i' : 1}],
|
\ ['Shougo/neco-syntax', { 'on_i' : 1}],
|
||||||
\ ['ujihisa/neco-look', { 'on_i' : 1}],
|
\ ['ujihisa/neco-look', { 'on_i' : 1}],
|
||||||
\ ['Shougo/context_filetype.vim', { 'on_i' : 1}],
|
\ ['Shougo/context_filetype.vim', { 'on_i' : 1}],
|
||||||
\ ['Shougo/neoinclude.vim', { 'on_i' : 1}],
|
\ ['Shougo/neoinclude.vim', { 'on_i' : 1}],
|
||||||
\ ['Shougo/neosnippet-snippets', { 'merged' : 0}],
|
\ ['Shougo/neosnippet-snippets', { 'merged' : 0}],
|
||||||
\ ['Shougo/neopairs.vim', { 'on_i' : 1}],
|
\ ['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}])
|
if g:spacevim_autocomplete_method ==# 'ycm'
|
||||||
call add(plugins, ['ervandew/supertab', {'loadconf_before' : 1, 'merged' : 0}])
|
call add(plugins, ['SirVer/ultisnips', { 'loadconf_before' : 1, 'merged' : 0}])
|
||||||
call add(plugins, ['Valloric/YouCompleteMe', {'loadconf_before' : 1, 'merged' : 0}])
|
call add(plugins, ['ervandew/supertab', { 'loadconf_before' : 1, 'merged' : 0}])
|
||||||
elseif g:spacevim_autocomplete_method ==# 'neocomplete' "{{{
|
call add(plugins, ['Valloric/YouCompleteMe', { 'loadconf_before' : 1, 'merged' : 0}])
|
||||||
call add(plugins, ['Shougo/neocomplete', {
|
elseif g:spacevim_autocomplete_method ==# 'neocomplete'
|
||||||
\ 'on_i' : 1,
|
call add(plugins, ['Shougo/neocomplete', {
|
||||||
\ 'loadconf' : 1,
|
\ 'on_i' : 1,
|
||||||
\ }])
|
\ 'loadconf' : 1,
|
||||||
elseif g:spacevim_autocomplete_method ==# 'neocomplcache' "{{{
|
\ }])
|
||||||
call add(plugins, ['Shougo/neocomplcache.vim', {
|
elseif g:spacevim_autocomplete_method ==# 'neocomplcache' "{{{
|
||||||
\ 'on_i' : 1,
|
call add(plugins, ['Shougo/neocomplcache.vim', {
|
||||||
\ 'loadconf' : 1,
|
\ 'on_i' : 1,
|
||||||
\ }])
|
\ 'loadconf' : 1,
|
||||||
elseif g:spacevim_autocomplete_method ==# 'deoplete'
|
\ }])
|
||||||
call add(plugins, ['Shougo/deoplete.nvim', {
|
elseif g:spacevim_autocomplete_method ==# 'deoplete'
|
||||||
\ 'on_i' : 1,
|
call add(plugins, ['Shougo/deoplete.nvim', {
|
||||||
\ 'loadconf' : 1,
|
\ 'on_i' : 1,
|
||||||
\ }])
|
\ 'loadconf' : 1,
|
||||||
endif
|
\ }])
|
||||||
return plugins
|
endif
|
||||||
|
return plugins
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function SpaceVim#layers#autocomplete#config()
|
function! SpaceVim#layers#autocomplete#config() abort
|
||||||
if g:spacevim_autocomplete_method ==# 'ycm'
|
if g:spacevim_autocomplete_method ==# 'ycm'
|
||||||
iunmap <S-TAB>
|
sunmap <S-TAB>
|
||||||
sunmap <S-TAB>
|
iunmap <S-TAB>
|
||||||
endif
|
endif
|
||||||
endfunction
|
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])
|
call add(g:unite_source_menu_menus.CustomKeyMaps.command_candidates, [description,cmd])
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! SpaceVim#mapping#shift_tab() abort
|
||||||
|
return pumvisible() ? "\<C-p>" : "\<Plug>delimitMateS-Tab"
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#mapping#tab() abort
|
function! SpaceVim#mapping#tab() abort
|
||||||
if getline('.')[col('.')-2] ==# '{'&& pumvisible()
|
if getline('.')[col('.')-2] ==# '{'&& pumvisible()
|
||||||
return "\<C-n>"
|
return "\<C-n>"
|
||||||
|
Loading…
Reference in New Issue
Block a user