# ddu plugins # Core plugins {{{ [[plugins]] # ddu.vim repo = 'Shougo/ddu.vim' depends = 'denops.vim' on_func = 'ddu#start()' hook_add = ''' " fuzzy finder start keybinds nnoremap nmap d nnoremap a call ddu#start({ \ 'name': 'current-ff', \ 'sourceOptions': { \ 'file_rec': {'path': vimrc#search_repo_root()}, \ }, \ }) nnoremap d call ddu#start({'name': 'dotfiles-ff'}) nnoremap h call ddu#start({'name': 'help-ff'}) nnoremap b call ddu#start({'name': 'buffer-ff'}) nnoremap P call ddu#start({'name': 'plugin-list-ff'}) nnoremap p call ddu#start({'name': 'project-list-ff'}) nnoremap ~ call ddu#start({'name': 'home-ff'}) nnoremap r call ddu#start({'name': 'register-ff'}) nnoremap s call ddu#start({ \ 'name': 'search-ff', \ 'ui': 'ff', \ 'uiParams': { \ 'ff': { \ 'startFilter': v:true, \ }, \ }, \ 'sources': [{ \ 'name': 'rg', \ 'params': {'input': input('Pattern: ')}, \ }], \ }) nnoremap m call ddu#start({'name': 'mrr-ff'}) nnoremap n call ddu#start({'name': 'mru-ff'}) " filer start keybins nnoremap nmap f nnoremap r call ddu#start({ \ 'name': 'project_root-filer', \ 'sourceOptions': { \ 'file': {'path': Search_repo_root()}, \ }, \ }) nnoremap a call ddu#start({ \ 'name': 'current-filer', \ 'sourceOptions': { \ 'file': {'path': expand('%:p:h')}, \ }, \ }) nnoremap d call ddu#start({'name': 'dotfiles-filer'}) nnoremap h call ddu#start({'name': 'home-filer'}) ''' hook_source = ''' " Global option and param call ddu#custom#patch_global({ \ 'uiOptions': { \ 'filer': { \ 'toggle': v:true, \ }, \ }, \ 'uiParams': { \ 'ff': { \ 'previewFloating': v:true, \ 'split': 'floating', \ 'prompt': '', \ 'filterSplitDirection': 'floating', \ 'displaySourceName': 'long', \ 'floatingBorder': 'single', \ 'previewFloatingBorder': 'single', \ 'filterFloatingPosition': 'top', \ }, \ 'filer': { \ 'split': 'vertical', \ 'splitDirection': 'topleft', \ 'winWidth': &columns /6, \ }, \ }, \ 'sourceOptions': { \ '_': { \ 'ignoreCase': v:true, \ 'matchers': ['matcher_substring'], \ }, \ 'file': { \ 'columns': ['icon_filename'], \ }, \ 'dein': { \ 'defaultAction': 'cd', \ }, \ 'help': { \ 'defaultAction': 'open', \ }, \ }, \ 'sourceParams': { \ 'dein_update': { \ 'useGraphQL': v:true, \ }, \ 'marks': { \ 'jumps': v:true, \ }, \ 'rg': { \ 'arg': [ \ '--ignore-case', '--column', '--no-heading', '--color', 'never', \ ], \ }, \ }, \ 'kindOptions': { \ 'file': { \ 'defaultAction': 'open', \ }, \ 'action': { \ 'defaultAction': 'do', \ }, \ 'word': { \ 'defaultAction': 'append', \ }, \ 'deol': { \ 'defaultAction': 'switch', \ }, \ 'readme_viewer': { \ 'defaultAction': 'open', \ }, \ }, \ 'actionOptions': { \ 'narrow': {'quit': v:false}, \ 'echo': {'quit': v:false}, \ 'echoDiff': {'quit': v:false}, \ }, \ 'columnParams': { \ 'icon_filename': { \ 'span': 2, \ 'iconWidth': 2, \ 'defaultIcon': { \ 'icon': '', \ }, \ }, \ }, \ }) " UI:ff presets call ddu#custom#patch_local('current-ff', { \ 'ui': 'ff', \ 'uiParams': { \ 'ff': { \ 'startFilter': v:true, \ }, \ }, \ 'sources': [{'name': 'file_rec'}], \ }) call ddu#custom#patch_local('dotfiles-ff', { \ 'ui': 'ff', \ 'uiParams': { \ 'ff': { \ 'startFilter': v:true, \ }, \ }, \ 'sourceOptions': { \ 'file_rec': {'path': expand('~/dotfiles')}, \ }, \ 'sources': [{'name': 'file_rec'}], \ }) call ddu#custom#patch_local('project-list-ff', { \ 'ui': 'ff', \ 'uiParams': { \ 'ff': { \ 'startFilter': v:true, \ }, \ }, \ 'sourceOptions': { \ 'file': {'path': expand('~/Project')}, \ }, \ 'sources': [{'name': 'file'}], \ }) call ddu#custom#patch_local('help-ff', { \ 'ui': 'ff', \ 'uiParams': { \ 'ff': { \ 'startFilter': v:true, \ }, \ }, \ 'sources': [ \ {'name': 'help'}, \ {'name': 'readme_viewer'}, \ ], \ }) call ddu#custom#patch_local('buffer-ff', { \ 'ui': 'ff', \ 'sources': [{'name': 'buffer'}], \ }) call ddu#custom#patch_local('plugin-list-ff', { \ 'ui': 'ff', \ 'uiParams': { \ 'ff': { \ 'startFilter': v:true, \ } \ }, \ 'sources': [{'name': 'dein'}], \ }) call ddu#custom#patch_local('home-ff', { \ 'ui': 'ff', \ 'uiParams': { \ 'ff': { \ 'startFilter': v:true, \ }, \ }, \ 'sourceOptions': { \ 'file': {'path': expand('~')}, \ }, \ 'sources': [{'name': 'file'}], \ }) call ddu#custom#patch_local('register-ff', { \ 'ui': 'ff', \ 'sources': [{'name': 'register'}], \ }) call ddu#custom#patch_local('mrr-ff', #{ \ ui: 'ff', \ uiParams: #{ \ ff: #{ \ startFilter: v:true, \ }, \ }, \ sources: [#{ \ name: 'mr', \ params: #{ \ kind: 'mrr', \ current: v:false, \ }, \ }], \ }) call ddu#custom#patch_local('mru-ff', #{ \ ui: 'ff', \ uiParams: #{ \ ff: #{ \ startFilter: v:true, \ }, \ }, \ sources: [#{ \ name: 'mr', \ params: #{ \ kind: 'mru', \ current: v:true, \ }, \ }], \ }) " UI:filer presets call ddu#custom#patch_local('current-filer', { \ 'ui': 'filer', \ 'sources': [{'name': 'file'}], \ }) call ddu#custom#patch_local('project_root-filer', { \ 'ui': 'filer', \ 'sources': [{'name': 'file'}], \ }) call ddu#custom#patch_local('dotfiles-filer', { \ 'ui': 'filer', \ 'sources': [{'name': 'file'}], \ 'sourceOptions': { \ 'file': { \ 'path': expand('~/dotfiles'), \ }, \ }, \ }) call ddu#custom#patch_local('home-filer', { \ 'ui': 'filer', \ 'sources': [{'name': 'file'}], \ 'sourceOptions': { \ 'file': { \ 'path': expand('~'), \ }, \ }, \ }) ''' # }}} # UI plugins {{{ [[plugins]] # ddu-ui-ff repo = 'Shougo/ddu-ui-ff' on_source = 'ddu.vim' [plugins.ftplugin] # ddu-ui-ff keybinds ddu-ff = ''' " Open file keybinds. {{{ nnoremap \ call ddu#ui#ff#do_action('itemAction') nnoremap o \ call ddu#ui#ff#do_action('itemAction', {'name': 'open', 'params': {'command': 'drop'}}) " Open file with horizontal window. nnoremap s \ call ddu#ui#ff#do_action('itemAction', \ {'name': 'open', 'params': {'command': 'split'}}) " Open file with vertical window. nnoremap v \ call ddu#ui#ff#do_action('itemAction', \ {'name': 'open', 'params': {'command': 'vsplit'}}) " Open file with another tab. nnoremap t \ call ddu#ui#ff#do_action('itemAction', \ {'name': 'open', 'params': {'command': 'tabedit'}}) " }}} " Multiple selection. nnoremap \ call ddu#ui#ff#do_action('toggleSelectItem') nnoremap * \ cal ddu#ui#ff#do_action('toggleAllItems') " fuzzy finder controll keybinds {{{ " Open selection menu. nnoremap a \ call ddu#ui#ff#do_action('chooseAction') " Open filter Window. nnoremap i \ call ddu#ui#ff#do_action('openFilterWindow') " Open preview window. nnoremap p \ call ddu#ui#ff#do_action('preview') nnoremap \ call ddu#ui#ff#do_action('refreshItems') " Close ddu window. nnoremap q \ call ddu#ui#ff#do_action('quit') nnoremap \ call ddu#ui#ff#do_action('quit') " Wrap when moving to the beginning and end of a line nnoremap j \ line('.') == line('$') ? \ 'gg' : 'j' nnoremap k \ line('.') == 1 ? \ 'G' : 'k' " }}} ''' ddu-ff-filter = ''' " fuzzy finder filter keybinds on insert mode {{{ inoremap \ close inoremap jj \ close inoremap \ close " fuzzy finder filter keybinds on normal mode nnoremap \ close nnoremap q \ close nnoremap jj \ close nnoremap \ close " }}} ''' [[plugins]] # ddu-ui-filer repo = 'Shougo/ddu-ui-filer' on_source = 'ddu.vim' [plugins.ftplugin] # ddu-ui-filer keybinds ddu-filer = ''' " Open of file or directory.{{{ " Open file or expand directory when directory. " Directory is expanded in tree type. " If you select a file that is already open, go to the open screen. nnoremap \ ddu#ui#filer#is_tree() ? \ "call ddu#ui#filer#do_action('expandItem', {'mode': 'toggle'})" : \ "call ddu#ui#filer#do_action('itemAction', {'name': 'open', 'params': {'command': 'drop'}})" " Open file with vertical split. nnoremap v \ call ddu#ui#filer#do_action('itemAction', {'name': 'open', 'params': {'command': 'vsplit'}}) " Open file with horizontal split. nnoremap s \ call ddu#ui#filer#do_action('itemAction', {'name': 'open', 'params': {'command': 'split'}}) " Open file with another tab window. nnoremap t \ call ddu#ui#filer#do_action('itemAction', {'name': 'open', 'params': {'command': 'tabedit'}}) " }}} " Operation of file or directory keybinds {{{ " Copy file or directory. nnoremap C \ call ddu#ui#filer#multi_actions([ \ ['itemAction', {'name': 'copy'}], \ ['clearSelectAllItems'], \ ]) " Move file or directory. nnoremap M \ call ddu#ui#filer#multi_actions([ \ ['itemAction', {'name': 'move'}], \ ['clearSelectAllItems'], \ ]) " Paste file or directory. nnoremap P \ call ddu#ui#filer#do_action('itemAction', {'name': 'paste'}) " Rename file or directory. nnoremap R \ call ddu#ui#filer#do_action('itemAction', {'name': 'rename'}) " Delete file or directory. nnoremap [delete] nmap d [delete] nnoremap [delete]d \ call ddu#ui#filer#do_action('itemAction', {'name': 'trash'}) nnoremap [delete]D \ call ddu#ui#filer#do_action('itemAction', {'name': 'delete'}) " make new file or directory. nnoremap N \ call ddu#ui#filer#do_action('itemAction', {'name': 'newFile'}) " Path operation in filer. " Yank path the file or directory. nnoremap y \ call ddu#ui#filer#do_action('itemAction', {'name': 'yank'}) \ echo 'Yanke path the "' . getreg('+') . '"' " }}} " Changes directory keybinds {{{ " Change current directory. nnoremap c \ call Filer_change_dir() " Move to parent directory. nnoremap h \ call Filer_parent_dir() " Move to previous directory. nnoremap l \ call Filer_prev_dir() " Move to first directory. nnoremap f \ call Filer_first_dir() " Move to directory of inputed path. nnoremap I \ call Filer_input_dir() " Move to home path. nnoremap ~ \ call ddu#ui#filer#do_action('itemAction', {'name': 'narrow', 'params': {'path': expand('~')}}) " }}} " Other filer keybinds...{{{ " select file action. nnoremap a \ call ddu#ui#filer#do_action('chooseAction') nnoremap o \ call ddu#ui#filer#do_action('expandItem', {'mode': 'toggle'}) nnoremap O \ call ddu#ui#filer#do_action('expandItem', {'maxLevel': -1}) " multiple files selection nnoremap \ call ddu#ui#filer#do_action('toggleSelectItem') nnoremap * \ call ddu#ui#filer#do_action('toggleAllItems') nnoremap > \ call ddu#ui#filer#do_action('updateOptions', { \ 'sourceOptions': { \ 'file': { \ 'matchers': ToggleHidden('file'), \ }, \}, \}) nnoremap / call ddu#start({ \ 'name': 'current-ff', \ 'sourceOptions': { \ 'file_rec': {'path': fnamemodify(b:ddu_ui_filer_path, ':p:h')}, \ }, \ }) " }}} nnoremap \ call ddu#ui#filer#do_action('checkItems') nnoremap q \ call ddu#ui#filer#do_action('quit') nnoremap \ call ddu#ui#filer#do_action('quit') " Wrap when moving to the beginning and end of a line nnoremap j \ line('.') == line('$') ? \ 'ggj' : 'j' nnoremap k \ line('.') == 2 ? \ 'G' : 'k' " UI:filer functions of custom keybind. {{{ " Moving directory paths. let g:ddu_ui_filer_prev_dirs = {} function! Filer_parent_dir() abort if b:ddu_ui_filer_path == '/' echo 'Cannot go back because it is the root directory.' return endif if !exists('g:ddu_ui_filer_prev_dirs[b:ddu_ui_name]') let g:ddu_ui_filer_prev_dirs[b:ddu_ui_name] = [] endif call add(g:ddu_ui_filer_prev_dirs[b:ddu_ui_name], b:ddu_ui_filer_path) call ddu#ui#filer#do_action('itemAction', {'name': 'narrow', 'params': {'path': '..'}}) endfunction function! Filer_change_dir() abort if !exists('g:ddu_ui_filer_prev_dirs[b:ddu_ui_name]') let g:ddu_ui_filer_prev_dirs[b:ddu_ui_name] = [] endif call add(g:ddu_ui_filer_prev_dirs[b:ddu_ui_name], b:ddu_ui_filer_path) call ddu#ui#filer#do_action('itemAction', {'name': 'narrow'}) endfunction function! Filer_prev_dir() abort if exists('g:ddu_ui_filer_prev_dirs[b:ddu_ui_name]') if empty(g:ddu_ui_filer_prev_dirs[b:ddu_ui_name]) echo 'Not found previous directory.' return endif else echo 'The directory has not been changed with this filer.' let g:ddu_ui_filer_prev_dirs[b:ddu_ui_name] = [] return endif let prev_dir_count = len(g:ddu_ui_filer_prev_dirs[b:ddu_ui_name]) - 1 let prev_dir_path = g:ddu_ui_filer_prev_dirs[b:ddu_ui_name][prev_dir_count] call remove(g:ddu_ui_filer_prev_dirs[b:ddu_ui_name], prev_dir_count) call ddu#ui#filer#do_action('itemAction', {'name': 'narrow', 'params': {'path': prev_dir_path}}) endfunction function! Filer_first_dir() abort if exists('g:ddu_ui_filer_prev_dirs[b:ddu_ui_name]') if empty(g:ddu_ui_filer_prev_dirs[b:ddu_ui_name]) echo "Maybe here is the first directory..." return endif else echo 'The directory has not been changed with this filer.' let g:ddu_ui_filer_prev_dirs[b:ddu_ui_name] = [] return endif let first_dir = g:ddu_ui_filer_prev_dirs[b:ddu_ui_name][0] let index_max_value = len(g:ddu_ui_filer_prev_dirs[b:ddu_ui_name]) - 1 call remove(g:ddu_ui_filer_prev_dirs[b:ddu_ui_name], 0, index_max_value) call ddu#ui#filer#do_action('itemAction', {'name': 'narrow', 'params': {'path': first_dir}}) endfunction function! Filer_input_dir() abort if exists('g:ddu_ui_filer_prev_dirs[b:ddu_ui_name]') if !empty(g:ddu_ui_filer_prev_dirs[b:ddu_ui_name]) call remove(g:ddu_ui_filer_prev_dirs[b:ddu_ui_name], 0, len(g:ddu_ui_filer_prev_dirs[b:ddu_ui_name]) - 1) endif else echo 'The directory has not been changed with this filer.' let g:ddu_ui_filer_prev_dirs[b:ddu_ui_name] = [] return endif let input_dir = fnamemodify(input('New cwd: ', b:ddu_ui_filer_path, 'dir'), ':p') call ddu#ui#filer#do_action('itemAction', {'name': 'narrow', 'params': {'path': input_dir}}) endfunction " Toggle show hidden file. function! ToggleHidden(name) let current = ddu#custom#get_current(b:ddu_ui_name) let source_options = get(current, 'sourceOptions', {}) let source_options_name = get(source_options, a:name, {}) let matchers = get(source_options_name, 'matchers', []) return empty(matchers) ? ['matcher_hidden'] : [] endfunction " }}} autocmd TabEnter,CursorHold,FocusGained call ddu#ui#filer#do_action('checkItems') ''' # }}} # Kind plugins {{{ [[plugins]] # ddu-kind-file repo = 'Shougo/ddu-kind-file' on_source = 'ddu.vim' [[plugins]] # ddu-kind-word repo = 'Shougo/ddu-kind-word' on_source = 'ddu.vim' # }}} # Source plugins {{{ [[plugins]] # ddu-source-file repo = 'Shougo/ddu-source-file' on_source = 'ddu.vim' [[plugins]] # ddu-source-file_rec repo = 'Shougo/ddu-source-file_rec' on_source = 'ddu.vim' [[plugins]] # ddu-source-help repo = 'matsui54/ddu-source-help' on_source = 'ddu.vim' [[plugins]] # vim-readme-viewer repo = '4513ECHO/vim-readme-viewer' on_cmd = 'ReadmeOpen' on_source = 'ddu.vim' hook_add = ''' let g:readme_viewer#plugin_manager = 'dein.vim' ''' [[plugins]] # ddu-source-buffer repo = 'shun/ddu-source-buffer' on_source = 'ddu.vim' [[plugins]] # ddu-source-action repo = 'Shougo/ddu-source-action' on_source = 'ddu.vim' [[plugins]] # ddu-source-register repo = 'Shougo/ddu-source-register' on_source = 'ddu.vim' [[plugins]] # ddu-source-rg repo = 'shun/ddu-source-rg' on_source = 'ddu.vim' [[plugins]] # ddu-source-mr repo = 'kuuote/ddu-source-mr' on_source = 'ddu.vim' # }}} # Filter plugins {{{ [[plugins]] # ddu-filter-matcher_substring repo = 'Shougo/ddu-filter-matcher_substring' on_source = 'ddu.vim' [[plugins]] # ddu-filter-matcher_hidden repo = 'Shougo/ddu-filter-matcher_hidden' on_source = 'ddu.vim' [[plugins]] # ddu-filter-matcher_relative repo = 'Shougo/ddu-filter-matcher_relative' on_source = 'ddu.vim' # }}} [[plugins]] # ddu-column-icon_filename repo = 'ryota2357/ddu-column-icon_filename' on_source = 'ddu.vim'