Shougo / ddu-ui-ff

Fuzzy finder UI for ddu.vim
MIT License
55 stars 26 forks source link

About the behavior of openFilterWindow when using autocmd and keymap #143

Closed yasunori0418 closed 6 months ago

yasunori0418 commented 6 months ago

Problems summary

The behavior is different when opening the filter manually and when opening the filter with autocmd.

Expected

There are the following differences when running openFilterWindow with autocmd and when running openFilterWindow manually using the configured keymap.

I would like to unify the behavior with keymap or autocmd. Ideally, the behavior when using keymap is the best, but as far as I have checked the specifications, I think that the behavior when using autocmd is the expected behavior.

Environment Information

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info

VIM - Vi IMproved 9.1 (2024 Jan 02, compiled May 26 2024 00:11:37)
Included patches: 1-445
Compiled by Arch Linux
Huge version without GUI.  Features included (+) or not (-):

Provide a minimal init.vim/vimrc without plugin managers (Required!)

const s:repo_path = expand("~/.cache/dpp/repos/github.com")
const s:plugins = [
  \ 'Shougo/ddu.vim',
  \ 'Shougo/ddu-ui-ff',
  \ 'Shougo/ddu-source-file_rec',
  \ 'Shougo/ddu-kind-file',
  \ 'Shougo/ddu-filter-matcher_substring',
  \ 'vim-denops/denops.vim',
\ ]
for plugin in s:plugins
  execute 'set' $'rtp^={s:repo_path}/{plugin}'
endfor

call ddu#custom#patch_global(#{
  \ ui: 'ff',
  \ sourceOptions: #{
    \ _: #{
      \ matchers: ['matcher_substring'],
    \ },
  \ },
  \ kindOptions: #{
    \ defaultAction: 'open',
  \ },
\ })

function! s:ddu_ff_keymaps() abort
  nnoremap <buffer> <CR>
  \ <Cmd>call ddu#ui#do_action('itemAction')<CR>
  nnoremap <buffer> i
  \ <Cmd>call ddu#ui#do_action('openFilterWindow')<CR>
  nnoremap <buffer> q
  \ <Cmd>call ddu#ui#do_action('quit')<CR>
endfunction

autocmd FileType ddu-ff call s:ddu_ff_keymaps()
autocmd User Ddu:uiDone ++nested
  \ call ddu#ui#do_action("openFilterWindow")

command! Test call ddu#start(#{sources: ['file_rec']})

How to reproduce the problem from neovim/Vim startup (Required!)

Shougo commented 6 months ago

Reproduced...

Shougo commented 6 months ago
autocmd User Ddu:uiDone ++nested
  \ call ddu#ui#do_action("openFilterWindow")

It must be async_action().