Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ddu-ff buffer is not focused after closing filter window #45

Closed
kbwo opened this issue Jun 20, 2022 · 3 comments
Closed

ddu-ff buffer is not focused after closing filter window #45

kbwo opened this issue Jun 20, 2022 · 3 comments

Comments

@kbwo
Copy link

kbwo commented Jun 20, 2022

Thank you for great plugin.

Problems summary

ddu-ff buffer lose cursor focus after closing filter window.

Environment Information

  • OS: Manjaro Linux
  • Neovim: 0.7.0
  • deno: 1.23.0
  • denops(SHA1): f967ee0730804649d340ec409d5e97c76dacf817

This issue occurs from latest commit d7fbe6c.

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

call plug#begin(expand('~/.vim/plugged'))
Plug 'vim-denops/denops.vim'
Plug 'Shougo/ddu.vim'
Plug 'Shougo/ddu-ui-ff'
Plug 'Shougo/ddu-source-file_rec'
Plug 'Shougo/ddu-kind-file'
Plug 'yuki-yano/ddu-filter-fzf'
Plug 'matsui54/ddu-source-file_external'
call plug#end()

call ddu#custom#patch_global({
  \  'ui': 'ff',
  \  'sources': [
    \  {'name': 'file_external', 
    \  'params': 
    \  {
        \  'cmd': ['rg', '--files', '--hidden', '--glob', '!.git', '--color', 'never']
      \  }
    \  }
  \  ],
  \   'sourceOptions': {
  \     '_': {
  \       'matchers': ['matcher_fzf'],
  \     },
  \   }
\  })
autocmd FileType ddu-ff call s:ddu_my_settings()
function! s:ddu_my_settings() abort
  nnoremap <buffer><silent> <CR>
        \ <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  nnoremap <buffer><silent> i
        \ <Cmd>call ddu#ui#ff#do_action('openFilterWindow')<CR>
  nnoremap <buffer><silent> q
        \ <Cmd>call ddu#ui#ff#do_action('quit')<CR>
endfunction

autocmd FileType ddu-ff-filter call s:ddu_filter_my_settings()

function! s:ddu_filter_my_settings() abort
  inoremap <buffer><silent> <CR>
  \ <Esc><Cmd>close<CR>
  nnoremap <buffer><silent> <CR>
  \ <Cmd>close<CR>
  nnoremap <buffer><silent> q
  \ <Cmd>close<CR>
endfunction

nmap <silent><c-p> :call ddu#start({})<CR>

After insert any word and close filter window by enter key, cursor don't move to the ddu-ff buffer but buffer of current opening file.
If this is expected, could you tell me the way to focus the ddu-ff buffer?

@Shougo
Copy link
Owner

Shougo commented Jun 21, 2022

  inoremap <buffer><silent> <CR>
        \ <Esc><Cmd>close<CR>
        \<Cmd>call win_gotoid(g:ddu#ui#ff#_filter_parent_winid)<CR>

It fixes your problem.

@kbwo
Copy link
Author

kbwo commented Jun 21, 2022

Thank you for your quick reply.
My problem has been solved completely!!

@kbwo kbwo closed this as completed Jun 21, 2022
@Shougo
Copy link
Owner

Shougo commented Jun 21, 2022

I have added ddu#ui#ff#close(). It is better.

kbwo added a commit to kbwo/dotfiles that referenced this issue Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants