liuchengxu / vista.vim

:cactus: Viewer & Finder for LSP symbols and tags
https://liuchengxu.github.io/vista.vim
MIT License
1.9k stars 87 forks source link

Escaping out of fzf finder displays main vista window #385

Closed farzadmf closed 3 years ago

farzadmf commented 3 years ago

Describe the bug I'm running :Vista finder fzf and I have let g:vista_close_on_fzf_select = 1. If I open the finder and choose something using Enter, everything is good, but if I press Escape to close the window, the fzf finder window is gone and the main vista window opens on the side, which is a bit annoying since I have to close that also.

Environment:

Vista info

    Current FileType:
Avaliable Executives: ['coc', 'ctags']
    Global Variables:
    let g:vista = {'get_tagline_under_cursor': function('434'), 'winnr': function('432'), 'source': {'fname': '', 'bufnr': 2, 'get_winid': function('436'), 'winid': 1000, 'winnr': 1, 'extension': function('441'), 'line': function('439'), 'get_winnr': function('435'), 'fil
etype': function('437'), 'lines': function('438'), 'line_trimmed': function('440'), 'scope_seperator': function('442'), 'fpath': ''}, 'provider': 'ctags', 'ctags_cmd': 'ctags --format=2 --excmd=pattern --fields=nksSaf --extras=+F --sort=no --append=no --extras=   --output
-format=json --fields=-PF -f- /home/farzad/.cache/nvim/vista/c8b49c4c072604113e31f93a397f1ba5562419087396ed68d36bb203884e38cf', 'winid': function('433'), 'tmps': []}
    let g:vista#executive#ctags#support_json_format = 1
    let g:vista#executives = ['ale', 'coc', 'ctags', 'lcn', 'nvim_lsp', 'vim_lsc', 'vim_lsp']
    let g:vista#extensions = ['markdown', 'rst']
    let g:vista#finders = ['clap', 'fzf', 'skim']
    let g:vista_blink = [2, 100]
    let g:vista_close_on_fzf_select = 1
    let g:vista_close_on_jump = 0
    let g:vista_cursor_delay = 400
    let g:vista_default_executive = 'ctags'
    let g:vista_disable_statusline = 1
    let g:vista_echo_cursor = 0
    let g:vista_echo_cursor_strategy = 'scroll'
    let g:vista_enable_centering_jump = 1
    let g:vista_executive_for = {}
    let g:vista_find_absolute_nearest_method_or_function = 0
    let g:vista_find_nearest_method_or_function_delay = 300
    let g:vista_fold_toggle_icons = ['▼', '▶']
    let g:vista_fzf_preview = ['right:50%']
    let g:vista_go_executive = 'coc'
    let g:vista_highlight_whole_line = 1
    let g:vista_icon_indent = ['└ ', '│ ']
    let g:vista_ignore_kinds = []
    let g:vista_no_mappings = 0
    let g:vista_sidebar_position = 'vertical botright'
    let g:vista_sidebar_width = 70
    let g:vista_stay_on_open = 1
    let g:vista_top_level_blink = [2, 100]
    let g:vista_update_on_text_changed = 0
    let g:vista_update_on_text_changed_delay = 500

Steps to reproduce given the above info

  1. Open neovim and run :Vista finder fzf
  2. Once the window is displayed, press Escape

Expected behavior Since I'm escaping out of the window, I'm expecting only my main buffer to be open.

Actual behavior Vista's "main" window is opened to the side.

Screenshot or gif (if possible) I can provide if you think is necessary

178me commented 3 years ago

When I use :Vista Finder FZF it doesn't focus on the floating window

ramonbakker commented 3 years ago

When I use :Vista Finder FZF it doesn't focus on the floating window

I had the same problem with coc and use this workaround: https://github.com/ramonbakker/vimrc/commit/1c1bb51a9b38d68ba88c1953588dadc737fae077.

farzadmf commented 3 years ago

I'm not sure why everything is weird now. Even when I select something, what used to happen was that there was a quick blinking on that line, but now, the line is highlighted and as soon as I press a motion key, only then the line blinks.

I hope the owner of the repo could at least give some guidance of what could be causing all these issues

178me commented 3 years ago

When I use :Vista Finder FZF it doesn't focus on the floating window

I had the same problem with coc and use this workaround: ramonbakker/vimrc@1c1bb51.

This program sometimes runs normally, sometimes it does report an error and freezes

liuchengxu commented 3 years ago

I hope the owner of the repo could at least give some guidance of what could be causing all these issues

I hope I can, but I no longer use fzf.vim, so can't help more here. I'm using vim-clap now BTW.

bergtholdt commented 3 years ago

This happened after a recent update, maybe it is the new toggle behaviour for the :Vista command from commit 7b42e09049

bergtholdt commented 3 years ago

Just to confirm my intuition, I downgraded to the revision before that via vim plug and now it works again as before

Plug 'liuchengxu/vista.vim', { 'commit': '4387164845165634a06941b17c2b4f398cffd193' }

Please revise commit 7b42e09.

farzadmf commented 3 years ago

So, seems like vista#sidebar#IsOpen() is not properly returning the correct value

liuchengxu commented 3 years ago

cc @Mte90

Mte90 commented 3 years ago

You are right I see the issue.

So https://github.com/liuchengxu/vista.vim/blob/081ca51a8bb572283c0023568e63e35e5f3a2cb4/autoload/vista/sidebar.vim#L132 IsOpen use a native method.

If I run that command in vim I don't get anything: Screenshot_20210224_180325

I was thinking that use the native method of the plugin was better and more clear as a:0 == 0 wasn't detecting rightly if the sidebar is open to close it.

I am doing a pr that fix the issue (tested right now).

Mte90 commented 3 years ago

If someone else can test the patch https://github.com/liuchengxu/vista.vim/pull/391

farzadmf commented 3 years ago

Hey @Mte90 , I'm not sure if I'm missing something, but I applied the patch and now running :Vista doesn't do anything for me.

Vista finder is fine (this is the command that I use: :call vista#finder#fzf#Run("coc"))

Mte90 commented 3 years ago

On my tests with :Vista nvim_lsp open and close the sidebar with no issue

farzadmf commented 3 years ago

Right, :Vista coc (or :Vista ctags) seem to be working fine for me. Maybe :Vista alone isn't supposed to do anything; I'm not sure TBH

Mte90 commented 3 years ago

I updated the pr with some code before my patch. To me just :Vista never worked so I always used with parameters.

liuchengxu commented 3 years ago

:Vista is equivalent to :Vista YOUR_DEFAULT_EXECUTIVE, see the default executive via :echo vista#GetExplicitExecutiveOrDefault(). Please confirm whether the patch works for you @farzadmf.

farzadmf commented 3 years ago

@liuchengxu the updated PR code seems to be fine (running :Vista alone displays vista window)

derekschrock commented 3 years ago

I think you now have the same problem but the other way around.

If the sidebar is open via :Vista or :Vista!! and you run :Vista finder fzf doesn't open and the sidebar closes.