# ddc plugins # Core plugins {{{ [[plugins]] # pum.vim repo = 'Shougo/pum.vim' hook_source = ''' call pum#set_option(#{ \ border: 'single', \ scrollbar_char: '┃', \ max_width: 90, \ }) ''' [[plugins]] # ddc-ui-pum repo = 'Shougo/ddc-ui-pum' on_source = 'ddc.vim' [[plugins]] # ddc.vim repo = 'Shougo/ddc.vim' depends = ['context_filetype.vim', 'denops.vim', 'pum.vim'] on_event = ['InsertEnter', 'CmdlineEnter', 'CursorHold'] hook_add = ''' " keybinds into cmdline mode {{{ nnoremap : call vimrc#commandline_pre(':'): xnoremap : call vimrc#commandline_pre(':'): nnoremap / call vimrc#commandline_pre('/')/ nnoremap ? call vimrc#commandline_pre('?')? " }}} ''' hook_source = ''' " UI settings {{{ " Use pum.vim call ddc#custom#patch_global('autoCompleteEvents', [ \ 'InsertEnter', 'TextChangedI', 'TextChangedP', \ 'CmdlineEnter', 'CmdlineChanged', 'TextChangedT', \ ]) call ddc#custom#patch_global('ui', 'pum') " }}} " Filter settings {{{ " Normal filter "call ddc#custom#patch_global('sourceOptions', #{ " \ _: #{ " \ ignoreCase: v:true, " \ matchers: ['matcher_head', 'matcher_length'], " \ sorters: ['sorter_rank'], " \ converters: ['converter_remove_overlap'], " \ }, " \ }) " Fuzzy filter call ddc#custom#patch_global('sourceOptions', #{ \ _: #{ \ ignoreCase: v:true, \ matchers: ['matcher_fuzzy'], \ sorters: ['sorter_fuzzy'], \ converters: ['converter_fuzzy'], \ }, \ }) " }}} " Source options. {{{ call ddc#custom#patch_global('sources', ['vsnip', 'around', 'file', 'rg']) call ddc#custom#patch_global('cmdlineSources', { \ ':': ['cmdline', 'cmdline-history', 'around'], \ '@': ['cmdline-history', 'input', 'file', 'around'], \ '>': ['cmdline-history', 'input', 'file', 'around'], \ '/': ['around', 'line'], \ '?': ['around', 'line'], \ '-': ['around', 'line'], \ '=': ['input'], \ }) " Editor completion source options. {{{ call ddc#custom#patch_global('sourceOptions', #{ \ around: #{mark: 'A'}, \ buffer: #{mark: 'B'}, \ file: #{ \ mark: 'F', \ isVolatile: v:true, \ minAutoCompleteLength: 1000, \ forceCompletionPattern: '\S/\S*', \ }, \ vsnip: #{ \ mark: 'snip', \ dup: v:true, \ }, \ nvim-lsp: #{ \ mark: 'LSP', \ forceCompletionPattern: '\.\w*|:\w*|->\w*', \ dup: 'force', \ }, \ necovim: #{mark: 'vim'}, \ rg: #{ \ mark: 'rg', \ minAutoCompleteLength: 5, \ }, \ skkeleton: #{ \ mark: 'SKK', \ matchers: ['skkeleton'], \ sorters: [], \ minAutoCompleteLength: 2, \ isVolatile: v:true, \ }, \ }) " }}} " Commandline completion source options. {{{ call ddc#custom#patch_global('sourceOptions', #{ \ cmdline: #{ \ mark: 'cmd', \ forceCompletionPattern: '\S/\S*', \ dup: 'force', \ }, \ cmdline-history: #{ \ mark: 'cmd-history', \ sorters: [], \ }, \ input: #{ \ mark: 'input', \ forceCompletionPattern: '\S/\S*', \ isVolatile: v:true, \ dup: 'force', \ }, \ line: #{ mark: 'line', }, \ }) " }}} " ddc source params {{{ call ddc#custom#patch_global('sourceParams', #{ \ buffer: #{ \ requireSameFiletype: v:false, \ fromAltBuf: v:true, \ bufNameStyle: 'basename', \ }, \ line: #{maxSize: 500}, \ nvim-lsp: #{ \ kindLabels: #{ \ Text: ' Text', \ Method: ' Method', \ Function: ' Function', \ Constructor: ' Constructor', \ Field: 'ﰠ Field', \ Variable: ' Variable', \ Class: 'ﴯ Class', \ Interface: ' Interface', \ Module: ' Module', \ Property: 'ﰠ Property', \ Unit: '塞 Unit', \ Value: ' Value', \ Enum: ' Enum', \ Keyword: ' Keyword', \ Snippet: ' Snippet', \ Color: ' Color', \ File: ' File', \ Reference: ' Reference', \ Folder: ' Folder', \ EnumMember: ' EnumMember', \ Constant: ' Constant', \ Struct: 'פּ Struct', \ Event: ' Event', \ Operator: ' Operator', \ TypeParameter: 'TypeParameter', \ }, \ }, \ }) " LSPのラベルタグの参考元: https://github.com/onsails/lspkind.nvim " }}} " }}} " filetype settings {{{ call ddc#custom#patch_filetype(['python', 'php', 'lua', 'yaml'], 'sources', \ ['nvim-lsp', 'vsnip', 'around', 'file', 'rg'], \ ) call ddc#custom#patch_filetype(['vim', 'toml'], 'sources', \ ['necovim', 'vsnip', 'around', 'file', 'rg'], \ ) call ddc#custom#patch_filetype(['ddu-ff-filter'], #{ \ keywordPattern: '[0-9a-zA-Z_:#-]*', \ sources: ['line', 'buffer'], \ specialBufferCompletion: v:true, \ }) " }}} " Keymaping {{{ " Insert-Mode inoremap \ pum#visible() ? 'call pum#map#insert_relative(+1)' : \ (col('.') <= 1 getline('.')[col('.') - 2] =~# '\s') ? \ '' : ddc#map#manual_complete() inoremap call pum#map#insert_relative(-1) inoremap call pum#map#select_relative(+1) inoremap call pum#map#select_relative(-1) inoremap call pum#map#confirm() inoremap \ pum#visible() ? 'call pum#map#cancel()' : '$' " Cmdline-Mode cnoremap \ pum#visible() ? 'call pum#map#insert_relative(+1)' : \ exists('b:prev_buffer_config') ? \ ddc#map#manual_complete() : nr2char(&wildcharm) cnoremap call pum#map#insert_relative(-1) cnoremap \ pum#visible() ? 'call pum#map#select_relative(+1)' : '' cnoremap \ pum#visible() ? 'call pum#map#select_relative(-1)' : '' cnoremap call pum#map#confirm() cnoremap \ pum#visible() ? 'call pum#map#cancel()' : '' " }}} call ddc#enable() ''' # }}} # source plugins {{{ [[plugins]] # ddc-source-around repo = 'Shougo/ddc-source-around' on_source = 'ddc.vim' [[plugins]] # ddc-buffer repo = 'matsui54/ddc-buffer' on_source = 'ddc.vim' [[plugins]] # ddc-source-file repo = 'LumaKernel/ddc-source-file' on_source ='ddc.vim' [[plugins]] # ddc-source-rg repo = 'Shougo/ddc-source-rg' on_source = 'ddc.vim' [[plugins]] # neco-vim repo = 'Shougo/neco-vim' on_ft = ['vim', 'toml', 'help'] [[plugins]] # ddc-source-nvim-lsp repo = 'Shougo/ddc-source-nvim-lsp' on_source = 'nvim-lspconfig' [[plugins]] # ddc-source-line repo = 'Shougo/ddc-source-line' on_source = 'ddc.vim' [[plugins]] # ddc-source-cmdline repo = 'Shougo/ddc-source-cmdline' on_source = 'ddc.vim' [[plugins]] # ddc-source-cmdline-history repo = 'Shougo/ddc-source-cmdline-history' on_source = 'ddc.vim' [[plugins]] # ddc-source-input repo = 'Shougo/ddc-source-input' on_source = 'ddc.vim' # }}} # filter plugins {{{ [[plugins]] # ddc-matcher_head repo = 'Shougo/ddc-matcher_head' on_source ='ddc.vim' [[plugins]] # ddc-matcher_length repo = 'Shougo/ddc-matcher_length' on_source ='ddc.vim' [[plugins]] # ddc-sorter_rank repo = 'Shougo/ddc-sorter_rank' on_source ='ddc.vim' [[plugins]] # ddc-converter_remove_overlap repo = 'Shougo/ddc-converter_remove_overlap' on_source = 'ddc.vim' [[plugins]] # ddc-fuzzy repo = 'tani/ddc-fuzzy' on_source = 'ddc.vim' # }}} # snippet plugins {{{ [[plugins]] # vim-vsnip repo = 'hrsh7th/vim-vsnip' hook_source = ''' imap vsnip#available(1) ? '(vsnip-expand-or-jump)' : '' smap vsnip#available(1) ? '(vsnip-expand-or-jump)' : '' " Jump forward or backward imap vsnip#jumpable(1) ? '(vsnip-jump-next)' : '' smap vsnip#jumpable(1) ? '(vsnip-jump-next)' : '' imap vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : '' smap vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : '' let g:vsnip_snippet_dirs = [ \ expand('~/.vsnip/friendly-snippets/snippets/'), \ ] let g:vsnip_filetypes = {} augroup user_vsnip_autocmd autocmd! autocmd User PumCompleteDone call vsnip_integ#on_complete_done(g:pum#completed_item) autocmd InsertEnter ~/dotfiles/config/nvim/toml/*.toml let g:vsnip_filetypes.toml = [context_filetype#get_filetype()] augroup END ''' [[plugins]] # vim-vsnip-integ repo = 'hrsh7th/vim-vsnip-integ' depends = 'vim-vsnip' on_source = 'ddc.vim' # }}}