shun / ddu-source-rg

MIT License
31 stars 16 forks source link

ddu_rg_live does not work when automatically open the filter window #39

Closed cohama closed 5 months ago

cohama commented 5 months ago

Step to reproduce

  1. Open vim/neovim with the following minimal vimrc.
  2. Do :DduRgLive.
  3. filterwindow (cmdline input) will be opened automatically.
  4. Press <CR> to do action but nothing happen. Pressing <CR> behave like undo.

Note: Maybe autocmd User Ddu:uiDone ++nested call ddu#ui#async_action('openFilterWindow') makes trouble.

Vim/Neovim version I tried

Vim: 9.1.445 Neovim: v0.11.0-dev-15+g62eb7e79a5

minimal vimrc

syntax enable
filetype plugin indent on

set rtp^=~/tmp/ddurglive/denops.vim
set rtp^=~/tmp/ddurglive/ddu.vim
set rtp^=~/tmp/ddurglive/ddu-source-rg
set rtp^=~/tmp/ddurglive/ddu-ui-ff
set rtp^=~/tmp/ddurglive/ddu-filter-matcher_substring
set rtp^=~/tmp/ddurglive/ddu-kind-file
call ddu#custom#patch_global(#{
\   ui: 'ff',
\   sourceOptions: #{
\     _: #{
\       matchers: ['matcher_substring'],
\     },
\   },
\   sourceParams : #{
\     rg : #{
\       args: ['--column', '--no-heading', '--color', 'never'],
\     },
\   },
\ })
command! DduRgLive call <SID>ddu_rg_live()
function! s:ddu_rg_live() abort
  call ddu#start(#{
  \   sources: [#{
  \     name: 'rg',
  \     options: #{
  \       matchers: [],
  \       volatile: v:true,
  \     },
  \   }],
  \   uiParams: #{
  \     ff: #{
  \       ignoreEmpty: v:false,
  \       autoResize: v:false,
  \     }
  \   },
  \ })
endfunction

function! s:ddu_my_settings() abort
  nnoremap <buffer><silent> <CR> <Cmd>call ddu#ui#do_action('itemAction', {'name': 'open'})<CR>
  nnoremap <buffer><silent> i <Cmd>call ddu#ui#do_action('openFilterWindow')<CR>
endfunction
autocmd FileType ddu-ff call s:ddu_my_settings()

autocmd User Ddu:ui:ff:closeFilterWindow call s:ddu_ff_filter_cleanup()
function! s:ddu_ff_filter_cleanup() abort
  call ddu#ui#ff#restore_cmaps()
endfunction

" Comment out the following line and DduRgLive works fine
autocmd User Ddu:uiDone ++nested call ddu#ui#async_action('openFilterWindow')
Shougo commented 5 months ago

Fixed. Please update ddu.vim.

cohama commented 5 months ago

Confirmed. Thanks!