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

fzf scrollbar question #321

Open
habahabahaba opened this issue Aug 22, 2024 · 9 comments
Open

fzf scrollbar question #321

habahabahaba opened this issue Aug 22, 2024 · 9 comments

Comments

@habahabahaba
Copy link

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.

@romkatv
Copy link
Owner

romkatv commented Aug 22, 2024

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?

@habahabahaba
Copy link
Author

habahabahaba commented Aug 22, 2024

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=|

@romkatv
Copy link
Owner

romkatv commented Aug 22, 2024

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

@habahabahaba
Copy link
Author

habahabahaba commented Aug 22, 2024

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.

@romkatv
Copy link
Owner

romkatv commented Aug 26, 2024

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.

@habahabahaba
Copy link
Author

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.

@romkatv
Copy link
Owner

romkatv commented Aug 27, 2024

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.

@habahabahaba
Copy link
Author

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.

@romkatv
Copy link
Owner

romkatv commented Aug 28, 2024

That's interesting.

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

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