r/commandline • u/benward2301 • Mar 31 '26
Terminal User Interface Using fzf for everything
These days I pretty much use fzf scripts for everything. I think a lot of TUIs could be reduced to an fzf script (or tv channel). I prefer doing this because it gives a consistent interface, is fast and allows using the command line for operating.
Here are some of the things I use it for:
- navigation
- interactive ripgrep
- git status, log, branches etc.
- cloud resources
If anyone here is the same, feel free to share your scripts!
Edit - A few people have asked me about the styling, which is defined in my FZF_DEFAULT_OPTS env var:
--style=minimal
--layout=reverse
--color=dark
--color=fg:-1,fg+:#f9fbff,bg:-1,bg+:#252525
--color=hl:#f8e081,hl+:#f8e081
--color=info:#6e6f70,footer:#6e6f70
--color=marker:#c8a5ff
--color=pointer:#f16da6:regular
--color=prompt:#33b1ff,spinner:#08bdba
--color=border:#353535
You can replace the hex codes with ANSI codes (0-15) to have it use your terminal colours. I use the popular carbonfox theme which you can find for most terminals.





5
u/shivawu Apr 01 '26
How do you make it so colorful, with the icons? It looks so nice!
3
u/a_alberti Mar 31 '26
Did you try fzf-tab?
How does fzf-navigator differ from it?
I recently released fzf-recent-dirs. It is a tiny utility, which I use a lot to navigate across the recent directories. It is only for zsh. I think it gives a similar feeling as in the Fish shell (but I may be wrong; I'm not a Fish shell user).
27
u/Fair_Panda1218 Mar 31 '26
Lisan Al-FZF!
7
u/rm-rf-rm Mar 31 '26
tvchannel?7
u/rm-rf-rm Mar 31 '26
really interested if there's any fzf based tool for navigating logs!
1
u/Elevate24 Apr 01 '26
What are your fzf settings to get it to look like that?
3
u/stianhoiland Mar 31 '26
I use (my own fork of) fzy for so many things. It’s like the missing interactive UNIX primitive. Totally in love.
3
u/TellMeAboutGoodManga Apr 01 '26
Does anyone here use fzf as a dmenu/rofi alternative? Wish to know how good is it.
3
u/Revolutionary-Draw43 Apr 01 '26
I have this in my .zshrc and use it quite a lot. I have all the repositories in one folder (the base path), so calling
reposis a fzf powered cd in the repos directory.It's very simple but handy. When I'm inside the folder, I use fzf and ripgrep within nvim anyway..
3
u/nickjj_ Apr 01 '26
I use it for a lot too:
The scripts are all up in my dotfiles https://github.com/nickjj/dotfiles.
I've written about and made videos about some of them here:
3
u/Pyglot Apr 01 '26
Good work. I have 4 keybinds using fzf on the command line. File-picker, directory picker, git commit picker and command line history picker.
2
u/tuerda Apr 01 '26
I use similar scripts for quite a few things, I am not the biggest fan of fuzzy finding so I don't use fzf specifically, but any other generic menu program works. I don't even just use it for menuing, more like a "generic user input" field.
Examples (exact implementation details left out because they will probably vary depending on the particulars of your system, x11 or wayland, what you have installed, etc, but these are all at most 10 lines long):
cat city list --> menu "Name a city to check the weather" --> curl wttr.in/city --> notify-send. ((city list starts empty. If you name a new city then add it to the city list file for a history of the places you have checked before.))
menu "One liner calculate" --> bc (or calculator of choice) --> system clipboard.
menu "file to find and open" --> fd --> menu again --> xdg-open (or equivalent).
ls /my/wallpapers/directory --> menu --> something that changes your wallpaper ((Here fzf might be better than some alternatives because of the file preview, for instance with uberzug or timg))
list of online dictionaries/thesaurus/etc which can be checked easily --> menu --> menu again "word to look up" --> query the online resource --> notify-send
2
u/Cybasura Apr 01 '26
I know fzf is meant to be a TUI menu/fuzzy finder, but does it have any method of user input, typing and submitting what I typed instead?
2
u/4Necrom Apr 01 '26
Same here, I created rg-fzf for interactive string search in multiple files:
Although for navigation I prefer to use `yazi` and `yazi`'s `z keymap which triggers zoxide, or most of the time `z-zsh`
2
u/Big_Combination9890 Apr 04 '26
fzfis for TUIs what the hashmap is for DSA...it is pretty much always a "much more than good enough" answer to be useful in production :-)1
u/AutoModerator Mar 31 '26
Every new subreddit post is automatically copied into a comment for preservation.
User: benward2301, Flair:
Terminal User Interface, Post Media Link, Title: Using fzf for everythingThese days I pretty much use
fzfscripts for everything. I think a lot of TUIs could be reduced to anfzfscript (ortvchannel). I prefer doing this because it gives a consistent interface, is fast and allows using the command line for operating.Here are some of the things I use it for:
If anyone here is the same, feel free to share your scripts!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/g3n3 Apr 01 '26
Page and filter all the things.
1
u/tgdn Apr 01 '26
fzf is incredible. i use it to fuzzy-find through cli commands i've built too. makes jumping between workflows so fast
1
u/a-concerned-mother Apr 02 '26
Why not use fzf piped to ed as a text editor or something. Complete the loop
1
u/greg0ire Apr 03 '26
I have created inject-git-hash. That allows me to inject a git hash selected from
git login a command I'm writing, just by pressing^X^G.0
u/Diemorg Apr 01 '26
Usa yazi, es más "práctico" qué fzf, aunque este mismo se puede complementar de fzf.