" hook_add {{{ let g:launcher_config.ddu = #{ \ char: 'd', \ run: { -> ddu#start(#{ sources: [#{ name: 'source' }] }) }, \ } nnoremap d Ddu -resume inoremap call ddu#start(#{ \ sources: [ \ #{ name: 'emoji', options: #{ defaultAction: 'feedkeys' } }, \ ], \ uiParams: #{ \ ff: #{ replaceCol: col('.') }, \ }, \ }) function! s:open_current_line_hunk() abort if !empty(&buftype) return endif autocmd vimrc User Ddu:uiDone ++once \ call ddu#ui#async_action('itemAction', #{ name: 'currentLine' }) call ddu#start(#{ \ name: 'git_diff_current', \ sourceOptions: #{ _: #{ path: expand('%:p') } }, \ }) endfunction nnoremap gd call open_current_line_hunk() call timer_start(10, { -> ddu#load('ui', ['ff']) }) " }}} " hook_source {{{ autocmd vimrc User Ddu:ui:ff:openFilterWindow call s:on_ddu_ff_filter() autocmd vimrc User Ddu:ui:ff:closeFilterWindow call ddu#ui#ff#restore_cmaps() function! s:on_ddu_ff_filter() abort " NOTE: lexima defines mappings on CmdlineEnter only once, so if we start Ddu from keymap, we need to define manually if empty(maparg('', 'c')) cnoremap lexima#expand('CR>', ':') endif call ddu#ui#ff#save_cmaps(['', '', '', '']) cnoremap cnoremap call ddu#ui#do_action('itemAction') cnoremap call ddu#ui#multi_actions([ \ ['cursorNext', #{ loop: v:true }], \ ['updateLightline'], \ ]) cnoremap call ddu#ui#multi_actions([ \ ['cursorPrevious', #{ loop: v:true }], \ ['updateLightline'], \ ]) if has('nvim') call cmdline#enable() endif endfunction call ddu#custom#load_config(expand('$DEIN_DIR/settings/ddu.ts')) " }}} " hook_post_update {{{ call ddu#set_static_import_path() echomsg '[ddu] ddu#set_static_import_path() called' " }}} " ddu-ff {{{ setlocal cursorline signcolumn=yes autocmd vimrc-ddu ModeChanged \ : if v:event.new_mode =~# '^[v\x16]' \ | execute 'normal! V' \ | endif nnoremap \ call ddu#ui#do_action('itemAction') nnoremap \ call ddu#ui#do_action('toggleSelectItem') xnoremap \ :call ddu#ui#do_action('toggleSelectItem') nnoremap a \ call ddu#ui#do_action('toggleAllItems') nnoremap c \ call ddu#ui#do_action('clearSelectAllItems') nnoremap i \ call ddu#ui#do_action('openFilterWindow') nnoremap \ call ddu#ui#do_action('chooseAction') nnoremap \ call ddu#ui#do_action('redraw', #{ method: 'refreshItems' })redraw nnoremap p \ call ddu#ui#do_action('togglePreview') nnoremap P \ call ddu#ui#do_action('toggleAutoAction') nnoremap q \ call ddu#ui#do_action('quit') nnoremap E \ call ddu#ui#do_action('itemAction', \ #{ params: eval(input('params: ', "#{}\Left>")) }) nnoremap d \ call ddu#ui#do_action('itemAction', #{ name: 'delete' }) nnoremap W \ call ddu#ui#do_action('itemAction', #{ params: \ #{ command: 'call snipewin#select()edit' } }) nnoremap < \ call ddu#ui#do_action('collapseItem') nnoremap > \ call ddu#ui#do_action('expandItem', #{ mode: 'toggle' }) if b:ddu_ui_name ==# 'file_tree' nnoremap \ ddu#ui#get_item().isTree \ ? "call ddu#ui#do_action('expandItem', #{ mode: 'toggle' })" \ : "call ddu#ui#do_action('itemAction', #{ name: 'open' })" elseif b:ddu_ui_name ==# 'git_diff_current' nnoremap \ call ddu#ui#do_action('itemAction', #{ name: 'currentHunk' }) endif " }}}