Shougo / ddu.vim

Dark deno-powered UI framework for Vim/NeoVim
MIT License
295 stars 24 forks source link

startFilter being ignored with resume #21

Closed creasty closed 2 years ago

creasty commented 2 years ago

Warning: I will close the issue without the minimal init.vim and the reproduction instructions.

Problems summary

Expected

Respect startFilter: v:true when resuming the UI

Environment Information

NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@Monterey

Features: +acl +iconv +tui
See ":help feature-compile"

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

     Run :checkhealth for more info

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

if has('vim_starting')
  let s:config_path = stdpath('config')
  for s:repo in [
    \ 'vim-denops/denops.vim',
    \ 'Shougo/ddu.vim',
    \ 'Shougo/ddu-ui-ff',
    \ 'Shougo/ddu-kind-file',
    \ 'matsui54/ddu-filter-fzy',
  \ ]
    let s:path = s:config_path . '/dein/repos/github.com/' . s:repo
    let &g:rtp .= ',' . s:path
  endfor
endif

call ddu#custom#patch_global({
  \ 'ui': 'ff',
  \ 'sourceOptions': {
    \ 'ghq': {
      \ 'matchers': ['matcher_fzy'],
    \ },
  \ },
\ })

command! Open call s:open()
function! s:open() abort
  call ddu#start({
    \ 'name': 'ghq',
    \ 'sources': [{ 'name': 'ghq' }],
    \ 'uiParams': { 'ff': { 'startFilter': v:true } },
    \ 'resume': v:true,
  \ })
endfunction

augroup _init_ddu
  autocmd!
  autocmd FileType ddu-ff call <SID>init_ddu()
  autocmd FileType ddu-ff-filter call <SID>init_ddu()
augroup END

function! s:init_ddu() abort
  nnoremap <buffer> <Esc> <Cmd>call ddu#ui#ff#do_action('quit')<CR>
  nnoremap <buffer> q <Cmd>call ddu#ui#ff#do_action('quit')<CR>
  nnoremap <buffer> <C-q> <Cmd>call ddu#ui#ff#do_action('quit')<CR>
  inoremap <buffer> <C-q> <Cmd>call ddu#ui#ff#do_action('quit')<CR>

  nnoremap <buffer> <CR> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  inoremap <buffer> <CR> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  nnoremap <buffer> <C-j> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  inoremap <buffer> <C-j> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>

  if &filetype ==# 'ddu-ff-filter'
    inoremap <buffer> <C-p> <Cmd>call ddu#ui#ff#execute("call cursor(line('.')-1,0)")<CR>
    inoremap <buffer> <C-n> <Cmd>call ddu#ui#ff#execute("call cursor(line('.')+1,0)")<CR>
  endif
endfunction

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

  1. Open ddu-ui by :Open
  2. Enter query & move cursor
  3. Quit with <C-q>
  4. Reopen ddu-ui

Screenshot (if possible)

https://user-images.githubusercontent.com/1695538/179214832-71ab3a69-505c-4d57-a097-f473b3c068c0.mov

Shougo commented 2 years ago

Fixed. Please update ddu-ui-ff.

creasty commented 2 years ago

Thank you always.