let s:config_json = readfile('.config/nvim/plugin_config/ddc.json') let s:config = json_decode(join(s:config_json, '')) call ddc#custom#patch_global(s:config) " nnoremap : call ddc_commandline_pre(): " function! s:ddc_commandline_pre() abort " " Overwrite sources " if !exists('b:prev_buffer_config') " let b:prev_buffer_config = ddc#custom#get_buffer() " endif " call ddc#custom#patch_buffer('cmdlineSources', ['cmdline', 'cmdline-history', 'around', 'file', 'look']) " " autocmd User DDCCmdlineLeave ++once call ddc_commandline_post() " autocmd InsertEnter ++once call ddc_commandline_post() " " " Enable command line completion " call ddc#enable_cmdline_completion() " endfunction " function! s:ddc_commandline_post() abort " " Restore sources " if exists('b:prev_buffer_config') " call ddc#custom#set_buffer(b:prev_buffer_config) " unlet b:prev_buffer_config " else " call ddc#custom#set_buffer({}) " endif " endfunction call ddc#enable() call signature_help#enable() call popup_preview#enable() function! s:imap_amend_with_pum(key, amend, ...) abort let fallback = a:0 > 0 ? a:1 : a:key execute printf("inoremap %s pum#visible()?'%s':'%s'", a:key, a:amend, fallback) endfunction call s:imap_amend_with_pum('', 'call pum#map#insert_relative(+1)') call s:imap_amend_with_pum('', 'call pum#map#insert_relative(-1)') call s:imap_amend_with_pum('', 'call pum#map#insert_relative(+1)') call s:imap_amend_with_pum('', 'call pum#map#insert_relative(-1)') call s:imap_amend_with_pum('', 'call pum#map#confirm()') call s:imap_amend_with_pum('', 'call pum#map#cancel()') call s:imap_amend_with_pum('', 'call pum#map#confirm()')