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

Bug: User mapping alt-h shadows flag binding for toggle_hidden #1810

Open
4 of 6 tasks
kaddkaka opened this issue Feb 8, 2025 · 12 comments
Open
4 of 6 tasks

Bug: User mapping alt-h shadows flag binding for toggle_hidden #1810

kaddkaka opened this issue Feb 8, 2025 · 12 comments
Labels
bug Something isn't working

Comments

@kaddkaka
Copy link

kaddkaka commented Feb 8, 2025

RTFM Checklist

  • I have searched exisiting issues / discussions
  • I have read the Wiki including the Advanced section
  • I have read man fzf / I am well versed in shell fzf

Operating system

Linux

Shell

bash

Neovim version (nvim --version)

VIM v0.10.4

Fzf version (fzf --version)

0.44.1 (debian) (maybe I receive newer verion from vim-plug)

Output of :lua print(os.getenv('FZF_DEFAULT_OPTS'))

--no-mouse

Is the problem reproducible with mini.sh?

  • My issue is reproducible with mini.sh
  • My issue IS NOT reproducible with mini.sh
  • I have not tested with mini.sh (not relevant, requires LSP, Windows, etc)

Fzf-lua configuration

Describe the bug / steps to reproduce

  1. launch min.sh
  2. ctrl-p
  3. hold down alt-h for 10~15 seconds

The picker window hangs and goes empty:

Image

Trying to get out of this state (by pressing ctrl-\ I received this error message:

Error executing vim.schedule lua callback: ...vim/site/pack/vendor/start/fzf-lua/lua/fzf-lua/shell.lua:313: vim/shared.lua:0: t: expected table, got nil
stack traceback:
        [builtin#36]: at 0x5b97d06da200
        ...vim/site/pack/vendor/start/fzf-lua/lua/fzf-lua/shell.lua:313: in function 'fn'
        ...vim/site/pack/vendor/start/fzf-lua/lua/fzf-lua/shell.lua:77: in function <...vim/site/pack/vendor/start/fzf-lua/lua/fzf-lua/shell.lua:76>

And ended up in the buffers picker:
Image

Is this a case of "if it hurts don't do it"?

@kaddkaka kaddkaka added the bug Something isn't working label Feb 8, 2025
@ibhagwan
Copy link
Owner

ibhagwan commented Feb 8, 2025

Is this a case of "if it hurts don't do it"?

Still shouldn’t happen, I did a similar test many times with live_grep ctrl-g and was never able to get it to hang, I’ll try with alt-h.

@ibhagwan
Copy link
Owner

ibhagwan commented Feb 8, 2025

Why does it show dash at the top of the tab? In the OP you wrote you use bash, is your vim.o.shell set to dash?

@kaddkaka
Copy link
Author

kaddkaka commented Feb 8, 2025

Why does it show dash at the top of the tab? In the OP you wrote you use bash, is your vim.o.shell set to dash?

Oh, that's the title of my terminal (Wezterm) which got set to dash when running the mini.sh command:

sh -c "$(curl -s https://raw.githubusercontent.com/ibhagwan/fzf-lua/main/scripts/mini.sh)"

I tried the above command with bash as well and got similar behavior. But I figured out this is probably 2 separate issues.

  1. I was able to reproduce the first issue by holding down alt-i. Then the popup picker window is blank, it's difficult to interact with with it. So still unsure what this is.

  2. The error message can get reproduced by:

    1. run mini.sh
    2. open a picker, for example <c-p>
    3. go to normal mode: <c-\><c-n>
    4. try to open buffers picker with: `<c->

@ibhagwan
Copy link
Owner

ibhagwan commented Feb 9, 2025

(2) should be fixed with b3e9303.

Will keep this open till we solve (1).

@kaddkaka
Copy link
Author

kaddkaka commented Feb 9, 2025

(2) should be fixed with b3e9303.

Will keep this open till we solve (1).

(2) is better now, no error 👍 However I noticed that after moving out of one picker (say :FzfLua) with :wincmd h and then opening another one like :FzfLua buffers, the existing popup gets reused so that so that my buffer picker that is supposed to be large (80%) and with a preview only has the small size of the :FzfLua-popup.

The picker in snacks.nvim avoids this issue happening by auto-closing the popup if the popup window is left. Auto closing would also have confused me left the first time I accidentally moved out of the FzfLua popup. Has autoclose been considered?

@ibhagwan
Copy link
Owner

ibhagwan commented Feb 9, 2025

(2) is better now, no error 👍 However I noticed that after moving out of one picker (say :FzfLua) with :wincmd h and then opening another one like :FzfLua buffers, the existing popup gets reused so that so that my buffer picker that is supposed to be large (80%) and with a preview only has the small size of the :FzfLua-popup.

Easily fixable by “reconfiguring” the window (I’ll add that).

The picker in snacks.nvim avoids this issue happening by auto-closing the popup if the popup window is left. Auto closing would also have confused me left the first time I accidentally moved out of the FzfLua popup. Has autoclose been considered?

This used to be the default but some users wanted to be able to switch out of the window without closing it so I remove the auto close.

@ibhagwan
Copy link
Owner

ibhagwan commented Feb 9, 2025

The picker in snacks.nvim

Mind me asking why do you need fzf-lua if you’re already using snacks?

@kaddkaka
Copy link
Author

kaddkaka commented Feb 9, 2025

The picker in snacks.nvim

Mind me asking why do you need fzf-lua if you’re already using snacks?

I'm using a vim heavy config with vim-plug and fzf.vim, but investigating alternatives for fzf.vim. Specifically some more out of the box lsp-fuzzy integrations.

Haven't decided if I want to stay with fzf.vim yet or not.

I tried fzf-lua first and then afterwards tried snacks.

Would you not recommend fzf-lua over snacks?

@ibhagwan
Copy link
Owner

ibhagwan commented Feb 9, 2025

Would you not recommend fzf-lua over snacks?

As the maintainer I’m obviously biased but users tend to like shiny new toys and snacks is great, personally I eat my own dog food or I wouldn’t maintain this project.

@asmodeus812
Copy link
Contributor

Would you not recommend fzf-lua over snacks?

For a tinkerer fzf-lua is unmatched, the sky is the limit, i have yet to face a use case i can not create a picker or a pipeline of pickers to achieve, also if you care about speed or performance.

@kaddkaka
Copy link
Author

Would you not recommend fzf-lua over snacks?

For a tinkerer fzf-lua is unmatched, the sky is the limit, i have yet to face a use case i can not create a picker or a pipeline of pickers to achieve, also if you care about speed or performance.

Did you try fzf.vim or snacks?

@ibhagwan
Copy link
Owner

@kaddkaka, I am able to somewhat reproduce this (the interface exits, doesn't hang) but for some odd reason this only happens when the binds are prefixed with alt, can you try the below setup with ctrl-{i|f|h} and let me know if you're able to reproruce?

Note that ctrl-i equals tab on terminals so pressing tab will trigger toggle ignore

local fzf = require("fzf-lua")
fzf.setup({
  actions = {
    files = {
      true,
      ["alt-i"] = false,
      ["alt-h"] = false,
      ["alt-f"] = false,
      ["ctrl-i"] = { fn = fzf.actions.toggle_ignore, reuse = true, header = false },
      ["ctrl-h"] = { fn = fzf.actions.toggle_hidden, reuse = true, header = false },
      ["ctrl-f"] = { fn = fzf.actions.toggle_follow, reuse = true, header = false },
    },
  },
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants