def vimrc#ddu#file_external_cmd(path: string): list var full_path = fnamemodify(path, ':p') if finddir('.git', full_path .. ';') !=# '' || findfile('.git', full_path .. ';') !=# '' return ['git', 'ls-files', '--cached', '--others', '--exclude-standard'] endif if executable('fd') return [ 'fd', '--hidden', '--type', 'file', '--type', 'symlink', '--exclude', '.git', '--color', 'never', ] endif if executable('find') return ['find'] endif return [] enddef def vimrc#ddu#setup_ui_ff_buffer() b:cursorline_disable = v:true nnoremap \ call ddu#ui#ff#do_action('itemAction') nnoremap s \ call ddu#ui#ff#do_action('toggleSelectItem') nnoremap i \ call ddu#ui#ff#do_action('openFilterWindow') nnoremap q \ call ddu#ui#ff#do_action('quit') if b:ddu_ui_name ==# 'file' s:setup_keymappings_for_file() endif enddef def vimrc#ddu#setup_ui_ff_filter_buffer() inoremap call ddu#ui#ff#close() nnoremap q call ddu#ui#ff#close() inoremap call ddu#ui#ff#do_action('itemAction') nnoremap call ddu#ui#ff#do_action('itemAction') inoremap getline('.') ==# '' ? 'call ddu#ui#ff#do_action("quit")' : '' inoremap call cursor(+1) inoremap call cursor(-1) nnoremap call cursor(+1) nnoremap call cursor(-1) if b:ddu_ui_name ==# 'file' s:setup_keymappings_for_file() endif enddef def s:cursor(n: number) final cmd = $'call cursor(vimrc#modulo(line(".") + {n} - 1, line("$")) + 1, 0)' ddu#ui#ff#execute(cmd) redraw! enddef def s:setup_keymappings_for_file() nnoremap \ call ddu#ui#ff#do_action( \ 'itemAction', \ #{name: 'open', params: #{command: 'botright split'}} \ ) nnoremap \ call ddu#ui#ff#do_action( \ 'itemAction', \ #{name: 'open', params: #{command: 'botright vsplit'}} \ ) nnoremap \ call ddu#ui#ff#do_action( \ 'itemAction', \ #{name: 'open', params: #{command: 'tabnew'}} \ ) inoremap \ call ddu#ui#ff#close()call ddu#ui#ff#do_action( \ 'itemAction', \ #{name: 'open', params: #{command: 'botright split'}} \ ) inoremap \ call ddu#ui#ff#close()call ddu#ui#ff#do_action( \ 'itemAction', \ #{name: 'open', params: #{command: 'botright vsplit'}} \ ) inoremap \ call ddu#ui#ff#close()call ddu#ui#ff#do_action( \ 'itemAction', \ #{name: 'open', params: #{command: 'tabnew'}} \ ) enddef