9 ms·
Fzf – a command-line fuzzy finder
- elromulous 5y agoripgrep[1] is usually mentioned in the same breath. I use them both daily. Truly indispensable. [1] https://github.com/BurntSushi/ripgrep https://github.com/BurntSushi/ripgrep
- john-tells-all 5y agoSeconded. Fzf didn't stick with me, but Ripgrep I use a dozen times an hour. It's incredibly fast, and mostly does exactly what I want.
- kzrdude 5y agoI use fzf to open files in vim. And I use ripgrep's file listing to feed into fzf, so I use both daily together :)
- mustache_kimono 5y agoI think you have to really love the idea of creating an app/script or hot key for a work flow to really start to enjoy using 'fzf'. And for most, I get it, it's "Where to start? Ugh, looks like work." For those that haven't tried yet, and want an entry point, I'd highly recommend you play around with the 'fzf' key bindings and completion scripts for zsh[0] to see what's possible. A little app of mine[1] also has an example of what one might call the minimal viable hot key script for you (note: for skim or 'sk', a 'fzf' Rust clone). [0]: https://github.com/junegunn/fzf/tree/master/shell https://github.com/junegunn/fzf/tree/master/shell [1]: https://github.com/kimono-koans/httm https://github.com/kimono-koans/httm
- b3morales 5y agoFor me the key to using fzf has been remembering that you can pipe ANYTHING into it. For example, grovelling though a git repo with grep might take multiple tries and careful refinement of search patterns. Or you can git log --oneline | fzf and interactively fuzz your way to the commit you're looking for. Having the ability to just update live with backspace when the search isn't matching makes a tremendous difference.
- mustache_kimono 5y agoYep. Awesome.
- skrebbel 5y agoJust to spread some credit/karma around a bit: if you use VS Code's "Find in Files" feature, you use ripgrep. It's why it's so fast.
- elromulous 5y agoDid not know that! I've always thought to myself how lightning fast find in files in vscode was. It all makes sense now.
- diego898 5y agoI’d love to incorporate fzf into a popup-everywhere tool like Alfred! If anyone has done something similar please let me know!
- tough 5y agohttps://developers.raycast.com/basics/create-your-first-extension https://developers.raycast.com/basics/create-your-first-exte... https://fzf.netlify.app/docs/latest https://fzf.netlify.app/docs/latest
- snihalani 5y agoThis product is so gold. <3
- pridkett 5y agoOnce I installed fzf.fish[0], my command line experience was radically changed for the better. The goodness of fish’s command line with search ability from fzf and seeing context from bat. Great for searching your history, commit hashes, variable names, and just about everything else. [0] https://github.com/PatrickF1/fzf.fish https://github.com/PatrickF1/fzf.fish
- thetadot 5y agoi use fzf daily - especially in Vim. thanks for this another resource I found valuable early on: https://www.youtube.com/watch?v=qgG5Jhi_Els https://www.youtube.com/watch?v=qgG5Jhi_Els EDIT: just realised this is the repo README by the fzf creator. he mentions Samoshkin's video also but it's worth repeating
- mustache_kimono 5y agoI have been really inspired by 'fzf' recently. Wrote a fun little ZFS utility[0] which I intended to just script with 'fzf', but have since found skim[1], or 'sk', and now use it both as my sole fuzzy finder app (because it's supposed to be interactive and it's faster!), and as a library for my little utility. I like them both for making fun zsh key bindings, so, so easy. [0]: https://github.com/kimono-koans/httm https://github.com/kimono-koans/httm [1]: https://github.com/lotabout/skim https://github.com/lotabout/skim
- dreamoffire 5y agoDo you have a source for the faster claim? I read back when I was investigating that fzf was still faster despite the Go vs Rust performance debate.
- mustache_kimono 5y agoThat's a good question. I'd be interested in any benchmark you saw. And although it seems like sk has come a long way since 2020[0], it may still be slower reading in a larger file. I really don't know. But I suppose I'd ask -- faster how? The linked benchmark really doesn't mean much to me. As an interactive app I judged it on how it felt latency-wise at the CLI. So, I would just try to scroll page-up while find was feeding in the files in my home directory. fzf would sometimes stall on my system (again not scientific) and would occasionally junk up the terminal when it got fed something strange. This could be a problem with fzf or it could have been a problem with how I was using it. On the other hand, sk at the CLI has been rock solid and very fast. skim as a library needs better docs and has a few other teething issues, but I'm using skim right now, because it feels faster, and because I use it as a library, there is some mental continuity between the two. Recognize and respect fzf in this space, it's just sk is doing it better for me, for now. [0]: https://github.com/lotabout/skim/issues/317 https://github.com/lotabout/skim/issues/317
- E39M5S62 5y agoSkim is effectively dead. fzf continues to receive new features and improvements. One of the stated goals of skim is that it will be option-compatible with fzf. Unfortunately that's only superficially true at this point. I recently removed sk support from a project because I was tired of special-casing for it. (ZFSBootMenu).
- gilbetron 5y agoAn awesome use case for fzf is to use it as a selector for a bunch of lines of text. So we have a script that gets the latest docker images and then we pipe it to fzf allowing you to select which one of them you want to use. Just a small thing to add on to the awesomeness that is fzf!
- bardan 5y agoI wrote a small "selector" script to use fzf or dmenu depending on whether a TTY is available. So if I am running a script involving selection outside of a terminal I get the dmenu GUI, but inside a terminal I get fzf.
- kbd 5y agoThis tool isn't "news", it's been a staple of my environment for years, but it's trending so upvoted. I use fzf everywhere, it's greatly enhanced my workflow. Recommend fzf-tab to use fzf for zsh autocompletion.
- atilimcetin 5y agoIf you still don't know how useful fzf is, you should start with integrating fzf and ctrl+r (reverse search).
- themodelplumber 5y agoHow do you do this, by the way? I used sudo apt install fzf and then realized I still have to set up the ctrl-r part. I think I installed it differently on other systems previously, and those installs took care of the integration for me.
- bardan 5y agoTry installing it from the source into eg. ~/.fzf and run ~/.fzf/install (if I remember correctly). It will offer to add bindings for ctrl-r etc. to the shell's rc file. Easy to update, just run git pull in ~/.fzf and install again.
- themodelplumber 5y agoI'll give that a shot. Thank you.
- petepete 5y agoI'm on Fedora and add it to my zsh with this line: https://github.com/peteryates/dotfiles/blob/master/zsh/.zshrc#L77 https://github.com/peteryates/dotfiles/blob/master/zsh/.zshr...
- kzrdude 5y agoEasy on its own but nonstandard, so it's annoying to manage every tool in its own way.
- jgauth 5y agoThere are instructions for enabling it in the package manager docs: apt-cache show fzf
- 5y ago
- bilalq 5y agoFzf was life changing when I first stumbled on it. Even cooler was the rabbit hole it led me down. Through fzf I discovered fd, bat, delta, and rg. That first exposure to fzf brought the biggest change to my workflow in years.
- ornornor 5y ago> delta I don’t understand what it does. Is it like an alternative diff or is it a patching utility based on a specifically formatted file?
- OJFord 5y agoAs far as git's concerned it's a pager - like `less` for example - that pages through `git diff` (for example) output. It formats that output, and then might typically be chained into `less` for actual paging. [I co-maintain, just issue triage really, a similar alternative called `diff-so-fancy`.]
- ornornor 5y agoThanks
- bilalq 5y agoDiff so fancy is great too! I go back and forth between it and delta at times by leaving delta as the default diff tool and adding a git alias for the following: dsf = "!f() { [ -z \"$GIT_PREFIX\" ] || cd \"$GIT_PREFIX\" && git diff --color \"$@\" | diff-so-fancy | less --tabs=4 -RFXS; }; f"
- aasasd 5y agoI failed a bunch of times to find a terminal differ that could display diffs and especially merges with convenience comparable to graphical tools like Meld, KDiff of Idea's built-in merger. So far the best I could dig up is `icdiff` for side-by-side diffs, and some Emacs mode that Magit uses, for three-way merges (the latter is not a terminal util really, just faster sometimes than going to Meld).
- uptheroots 5y agoFZF is one of the best programs I've ever used
- john-tells-all 5y agoAnother wonderful tool is "entr". It just runs a program when files change. It's incredible. I use it 20-40 times an hour to do very fast Dev/DevOps development: - "run Pytest when Python files change" - "I forgot how to use ps, run my-ps.sh when it changes and show me the output" - "rebuild all these Kubernetes resources when I edit the YAML files" - "run fast lint, then unit test Python files, then invoke one and show me the results" Link: https://jvns.ca/blog/2020/06/28/entr/ https://jvns.ca/blog/2020/06/28/entr/
- animal_spirits 5y agoWow! Thanks
- skrebbel 5y agoI use https://watchexec.github.io/ https://watchexec.github.io/ for this, which looks similar. Anyone who tried both and knows which one is better?
- benatkin 5y agoentr is written in C, watchexec is written in Rust. There's another one that I've used that is written in go: https://github.com/cespare/reflex https://github.com/cespare/reflex I am inclined to use watchexec next time I need one, because like go, I can read it more easily than c, but also because I looked at the web page and GitHub repo and it seems worth trying. For instance, it shows how to use it as a library instead of just as a command-line tool. https://watchexec.github.io/ https://watchexec.github.io/
- sinkensabe 5y agoI love watchexec! Really fast when doing TDD
- kzrdude 5y agowatchexec is a lot better at watching directories. entr deals with (existing files) best.
- userbinator 5y ago
- blindseer 5y agoIf you are interested in using fzf in neovim, check out this project: https://github.com/ibhagwan/fzf-lua https://github.com/ibhagwan/fzf-lua.
- vmandela 5y agoIf you like fzf, iterfzf offers an easy way to add the same selection functionality into python scripts. https://pypi.org/project/iterfzf/ https://pypi.org/project/iterfzf/ The python package also includes the fzf binary.
- pizza 5y agoripgrep, fzf, fd-find, ctrl-r, history-substring-search oh-my-zsh plugin, exa --tree --depth=x, tldr-pages, all that combined... chef's kiss
- wyclif 5y agoI use fzf from within vim every day and I can't imagine working without it.
- aryamaan 5y agoWhat's the way I can run fzf for words than characters. I would to like to use it for my web-history. And maybe for webpages I have visited too.
- endorphine 5y agoI can totally see why fzf is a great utility and is indeed very cool but I don't see real value other than as a Vim plugin for Ctrl-P. For a Ctrl-R replacement in the terminal, it never sticked with me, because getting more than 1 results was distracting. Also, if I'm in a directory and want to open a file in vim that I'm not sure of its location, I do `vim` and then Ctrl-P. I tried to incorporate it a few times in my workflow, but I couldn't see the value that would justify the overhead of having to learn a different tool.
- mfontani 5y agoIt can be useful to let you (fuzzily) pick from a list of things to execute a command. I use it to interact with git, i.e.: - checkout local git branch from curated list of branches fed through fzf - cherry pick commits from the previous (@{-1}) branch, using fzf + preview showing each commit's "diff" - pick recent SHA to git revert - pick files changed from {master,main,blead} - pick files currently uncommitted
- aidos 5y agoOh jeez, those are great examples. Thanks. I only use it in neovim (telescope), this post and your comment have inspired me to start trying it on the command line.
- b3morales 5y agoFor further inspiration, there are some interesting scripts making use of fzf here: https://github.com/DanielFGray/fzf-scripts https://github.com/DanielFGray/fzf-scripts
- stjohnswarts 5y agoBecause it's a two-dimensional ctrl-R; therefore far superior. You can look through variations of the same command. If you do a lot of CLI that's important, at least to some of us.
- boshanib 5y agoAm I the only one who prefers FZY ? https://github.com/jhawthorn/fzy https://github.com/jhawthorn/fzy
- 0xdeadb00f 5y agoI prefer it also :)
- rand0m4r 5y agosame here, I've tried FZF, skim but fzy is my favorite
- pletnes 5y agoAlso you can pipe stuff into it and select interactively. Splendid for when you don’t quite know what you’re looking for - yet.
- otikik 5y agoIt has replaced vim’s “open file” and “switch to buffer” for me. I occasionally use it in the command line, by expanding *. Not that often as in Vim, but very useful. I still need to find a satisfactory way to do “find in files” with vim. I use a custom script to call ag and it’s enough, but a bit clunky at times.
- jobegrabber 5y agoI bind Ctrl-J to ":Ag " so I'll simply have to type in roughly what I'm searching for and then get the pop-up to refine the search and do selections. I imagine you have a similar approach, what's clunky about it for you?
- otikik 5y agoLack of auto completion on filenames/dirs. Not seeing results while I type, like with fzf
- JetSetIlly 5y agoIf you're using fzf.vim (https://github.com/junegunn/fzf.vim https://github.com/junegunn/fzf.vim) then you can use :Rg or :Ag. This will run ripgrep or silver-searcher and present the results in a fuzzy finder window.
- petepete 5y agoThis is great when you want to jump to a specific place. I also use vim-grepper (mapped to leader-g) for finding in files and populating the quickfix list. https://github.com/mhinz/vim-grepper https://github.com/mhinz/vim-grepper
- CZiNTrPT 5y agoI never found a way to search for a couple of words that are near each others (like on start and end of a line eg) Does that work for you? I thought that's what a fuzzy finder is
- stanislavb 5y agoHere they are some alternatives: https://www.libhunt.com/junegunn/fzf https://www.libhunt.com/junegunn/fzf
- justaj 5y agoMany of the apps listed there are not alternatives, but something that can be used in combination with fzf.
- RadioactiveMan 5y agoFzf is brilliant. Recently I found fzrepl (https://github.com/danielfgray/fzf-scripts/blob/master/fzrepl https://github.com/danielfgray/fzf-scripts/blob/master/fzrep...), which blew my mind. It uses fzf and its preview window to create a repl for other programs, such as jq. That's great for figuring out a query for jq since I use it so rarely.
- E39M5S62 5y agofzf is a fantastic tool. The main interface of ZFSBootMenu is created with it. It has a pretty solid set of scripting capabilities! https://github.com/zbm-dev/zfsbootmenu/blob/master/media/v1.11.0-multi-be.png https://github.com/zbm-dev/zfsbootmenu/blob/master/media/v1.... https://github.com/zbm-dev/zfsbootmenu/blob/master/zfsbootmenu/lib/zfsbootmenu-lib.sh#L93 https://github.com/zbm-dev/zfsbootmenu/blob/master/zfsbootme...
- sxg 5y agoExtremely valuable tool that I use nearly every day. Also check out the vim plugin: https://github.com/junegunn/fzf.vim https://github.com/junegunn/fzf.vim.
- harrychin2 5y agoThis is one of the first things I install on a new machine after oh-my-zsh
- cyberpunk 5y agoI'm not trying to troll you or be annoying or get off my lawn kinda thing right, but seriously, what the fuck is the point of oh-my-zsh? I still use ksh these days (actually, the openbsd version, even on linux) and it behaves EXACTLY the same way as a bash shell to the uninitiated (ctrl+r, fc -l, etc etc etc).. I have some little shell functions that I use for things, like 'git_branch()' which I use with some aliases (I have >200 shell aliases).. ZSH has a fucking ftp client in it right? And it still just behaves like bash? What does it do on top? Am I missing something? :}
- mustache_kimono 5y ago> I have some little shell functions that I use for things, like 'git_branch()' which I use with some aliases (I have >200 shell aliases).. I think you may have just answered your own question -- it includes ready-made shell themes and plugins. Not everyone wants to work that hard (including me!).
- zaphirplane 5y agoYou are asking the point of omz and saying ksh has the same features as zsh omz is a tool for zsh users, that is its purpose in life Zsh has a lot more features than ksh, the functionality ksh has is the lower bound if it works for you great If you enjoy DIY writing 200 aliases great, zsh like bash is more than path autocomplete and aliases it’s a lot more
- 5y ago