" hook_add {{{ nnoremap s Ddu \ -name=files file \ -source-option-file-path=`'$BASE_DIR'->expand()` \ -ui-param-ff-split=`has('nvim') ? 'floating' : 'horizontal'` \ -resume \ nnoremap ss \ Ddu -name=files file_point file_old \ `'.git'->finddir(';') != '' ? 'file_git' : ''` \ file -source-option-file-volatile \ file -source-param-file-new -source-option-file-volatile \ -unique -expandInput \ -resume=` \ ddu#get_items(#{ sources: ['file_point'] })->empty() \ ? 'v:true' \ : 'v:false' \ ` \ -ui-param-ff-displaySourceName=short \ -ui-param-ff-split=`has('nvim') ? 'floating' : 'horizontal'` \ nnoremap / Ddu \ -name=search line -resume=v:false \ -ui-param-ff-ignoreEmpty \ -source-param-line-ignoreEmptyInput \ -input='`'Pattern: '->cmdline#input()->escape(' ')`' \ nnoremap * Ddu \ -name=search line -resume=v:false \ -input='`expand('')`' \ nnoremap ;g Ddu \ -name=search rg -resume=v:false \ -ui-param-ff-ignoreEmpty \ -source-param-rg-input= \'`'Pattern: '->cmdline#input(''->expand())`' \ xnoremap ;g yDdu \ -name=search rg -resume=v:false \ -ui-param-ff-ignoreEmpty \ -source-param-rg-input= \'`'Pattern: '->cmdline#input(v:register->getreg())`' \ nnoremap ;f Ddu \ -name=search rg -resume=v:false \ -ui-param-ff-ignoreEmpty \ -source-param-rg-input= \'`'Pattern: '->cmdline#input(''->expand())`' \ -source-option-rg-path= \'`'Directory: '->cmdline#input($'{getcwd()}/', 'dir')`' \ nnoremap ;a Ddu \ -name=search rg -resume=v:false \ -source-option-rg-volatile \ nnoremap n Ddu \ -name=search -resume \ nnoremap ;r Ddu \ -name=register register \ -source-option-register-defaultAction= \`'.'->col() == 1 ? 'insert' : 'append'` \ -ui-param-ff-autoResize \ nnoremap ;d Ddu \ -name=outline markdown \ -ui-param-ff-ignoreEmpty \ -ui-param-ff-displayTree \ nnoremap [Space]o Ddu \ -name=output output \ -source-param-output-command= \'`'Command: '->cmdline#input('', 'command')`' \ xnoremap ;r \ (mode() ==# 'V' ? '"_R' : '"_d') \ .. 'Ddu -name=register register \ -source-option-ff-defaultAction=insert \ -ui-param-ff-autoResize' xnoremap ;g call DduUrlItems() function! DduUrlItems() const region = getregion( \ getpos('v'), getpos('.'), #{ type: mode() }) if region->empty() return endif " Get selected URL const url = region[0]->substitute('\s*\n\?$', '', '') " Convert to items. const items = [url] \ ->map({ _, url -> #{ \ word: url, \ kind: 'url', \ action: #{ \ url: url, \ }, \ } \ }) "call ddu#start(#{ " \ sources: ['item'], " \ sourceParams: #{ " \ item: #{ " \ items: items, " \ }, " \ }, " \ }) " Call chooseAction directly call ddu#start(#{ \ sources: ['action'], \ sourceParams: #{ \ action: #{ \ items: items, \ }, \ }, \ }) endfunction " FilterUpdateCallback test function! DduFilterCallback(input) if a:input->stridx('@') != 0 return a:input endif " Use file source instead. call ddu#ui#do_action('updateOptions', #{ \ sources: [ \ #{ name: 'file' }, \ ], \ }) call ddu#ui#do_action('redraw', #{ method: 'refreshItems' }) return a:input[1:] endfunction " Open filter window automatically "autocmd User Ddu:uiDone ++nested " \ call ddu#ui#async_action('openFilterWindow') autocmd MyAutoCmd User Ddu:uiOpenFilterWindow \ call s:ddu_filter_my_settings() function s:ddu_filter_my_settings() abort set cursorline call ddu#ui#save_cmaps([ \ '', '', \ ]) cnoremap \ call ddu#ui#do_action('cursorNext', #{ loop: v:true }) cnoremap \ call ddu#ui#do_action('cursorPrevious', #{ loop: v:true }) endfunction autocmd MyAutoCmd User Ddu:uiCloseFilterWindow \ call s:ddu_filter_cleanup() function s:ddu_filter_cleanup() abort set nocursorline call ddu#ui#restore_cmaps() endfunction " Initialize ddu.vim lazily. if !'g:shougo_s_github_load_state'->exists() call timer_start(500, { _ -> LazyDdu() }) function LazyDdu() call ddu#load('files', 'ui', ['ff']) call ddu#load('files', 'kind', ['file']) call ddu#load('files', 'source', \ ['file_point', 'file_old', 'file_git', 'file'] \ ) endfunction endif " }}} " hook_source {{{ call ddu#custom#load_config('$BASE_DIR/ddu.ts'->expand()) " }}}