romkatv/zsh4humans

fzf scrollbar question

Opened this issue · 9 comments

Hello Roman and thank you for your work with zsh4humans. I recently reverted to it as a more stable and widely compatible option.
Question: I seem to recall you saying, you rewrote fzf for zsh4humans. If you did, did you keep a "scrollbar" indicator in or left it out?
I do not see a scroll indicator inside the fzf interface and all my attempts to style it with fzf-flags throw an error.

Thank you again for your work.

z4h is using the stock fzf, although not the latest version. I upgrade it every now and then after reviewing and testing recent changes.

Which flag are you trying to use, and with which widget?

Thank you for the quick response!
I tried '--scrollbar' (as per fzf docs) and I tried '--scroll', for the zstyle ':z4h:*' fzf-flags.

Here is my current setting, that works fine:
zstyle ':z4h:*' fzf-flags --color=16,fg:-1,bg:-1,hl:02,hl+:01:underline,bg+:-1,fg+:-1:underline,prompt:02,pointer:01,marker:13,spinner:4,info:4,border:8 --pointer='▶' --border=rounded

This setting throws an error:
zstyle ':z4h:*' fzf-flags --color=16,fg:-1,bg:-1,hl:02,hl+:01:underline,bg+:-1,fg+:-1:underline,prompt:02,pointer:01,marker:13,spinner:4,info:4,border:8 -e-pointer='▶' --border=rounded --scrollbar='|'
Error: unknowpushtion: --scrollbar=|

Probably a new flag. You can try installing your own fzf and using that. Or wait until I upgrade fzf vendored by z4h.

Thank you!
Should I do it with : z4h install junegunn/fzf || return?
Or with: zstyle ':z4h:' auto-update 'yes'?
Ok, I just reread your response and my second option is stupid. Sorry for that.

Update:
I placed a newer compiled version of fzf into the $Z4H/fzf (replacing the z4h version), and on the first glance, fzf is working as usual, scrollbar (indicator) is added to the right side of the fzf interface and --scrollbar flag is working now.
If something breaks, I'll just revert to the original z4h version and report here.

Report1:
Don't know if this is an issue or intended behavior, or whether it was the same in the previous version of fzf that z4h uses. In any case, when going through completions, some of them get truncated in a really unhelpful way (starting from the left):
Screenshot 2024-08-24 at 09 42 34.
Just to clarify, I do not say it's a z4h bug. I'm only reporting it here, because I said, I would, and if it is not helpful, just let me know.

Should I do it with : z4h install junegunn/fzf || return?

You can install fzf with a package manager of your choice. Seeing that you are already using brew, you can use brew install fzf. Run z4h update after that and you are good to go.

when going through completions, some of them get truncated in a really unhelpful way

I've never seen this kind of truncation, so I assume it's a new addition to fzf. The broken column alignment is likely a bug.

Thank you! I assumed z4h update only updates z4h itself and plugins installed with z4h installed.

Report2: I'm on Sonoma 14.5, fzf version 0.55. Yesterday I tried using bindkey z4h-cd-down Shift+Down (I assume, it uses fzf under the hood). I was looking for the directory that was one subdirectory away and the query was not unique to this directory. It took about 10 minutes and a few gigabytes of free space.

I don't understand Report2. Specifically, I don't understand what you did and what happened when you did that.

In any case, you might want to install bfs. I'm guessing brew install bfs might do the trick. This will make recursive file completions and things like z4h-cd-down better.

Report2 (rephrased and updated): I have a directory .../myname/Books/Roger Zelazny on my computer.

  1. Being inside the directory .../myname, I pressed Shift+Down and entered 'zelazny' (without quotes) as a search term.
  2. A few minutes later (while the search was going), I changed the search term to 'zelazny !music' to exclude unwanted results.
  3. The search ended successfully about 10-15 minutes later and the amount of free space on my computer decreased
    by 2-3 gigabytes. My GUESS would be, it was used as swap by the search process and will be cleared after the next reboot.

I decided to report this experience because I was surprised by the time and memory costs of the search process.

Thank you for suggesting the bfs plugin; I can see, how a breadth first search can be more efficient in this situation. I imagine, I would have to modify my .zshrc after installing the bfs plugin in order to connect it to the standard z4h tools.

That's interesting.

You don't need to modify .zshrc after running brew install bfs.