Live data from Hacker News

So you've installed `fzf` – now what?

andrew-quinn.me

141–150 of 292 posts

Re: So you've installed `fzf` – now what?

#141

Is there a preceding blog post I could read here? Something like, "So you've just heard of fzf for the first time, what even is it?" I was kind of surprised that the author doesn't even make a passing attempt to define or explain it.

There isn't, but this one provides a good overview. https://www.redhat.com/sysadmin/fzf-linux-fuzzy-finder The tl;dr is that it provides terminal fuzzy finding that can be plugged into just about any task that involves finding things. I use it many times an hour, it's the main way I navigate files and buffers in nvim, it's how I find files in my projects, it's how I select sessions in tmux. I'd be lost without it.

Thanks for the link!

Re: So you've installed `fzf` – now what?

#142

I really like the suggested command ` $(fzf)` to quickly open files in relative to the directory I am in. However, when I abort the fuzzy find with esc, it still opens without a file input, which is not what I want, so I wrote a little script for my shell config to prevent this: fuzz() { file=$(fzf) if [ ${#file} -gt 0 ]; then nvim "$file" # or any editor you prefer else : fi }

I hope this article along with this comment serves as a gateway drug for people to realize fzf is also really useful in injecting some interactivity into their shell scripts. It feels different to write scripts which call down fzf from the heavens for a split second.

I am very new to shell scripting and as I wrote the script, I actually just realized that I can plug anything into fzf that is split into lines of text and that I can use the selected output for further processing, since it’s just text.

I just love how simple it is to stick anything together via the universal plain text interface in the shell and even pipe this text/dataflow through interactive tools like fzf, as you just mentioned.

Re: So you've installed `fzf` – now what?

#143
post #133

Earlier quoted context omitted.

Issues like this are why I write everything into scripts and pipelines, even the munging. This way everything is documented: the environment, the input, the output, the log file, what ran, and longform comments with why I was doing it.

Good choice but that for me breaks the "carpe Diem" part of the inspiration that can go away in a whim, that it's what I have when I'm writing (complex) one liners in the shell. Or maybe I'm just lazy.

Just have two windows open, your console and your editor. If you ran a command that worked just copy and paste it into the editor. There's your script if you didn't want to get fancy. If you copied your initial cd command or whatever you'd know what the relative paths were referring too as well (although this issue is why I have gotten into the habit of using a path variable instead of relative or anything hardcoded).

Re: So you've installed `fzf` – now what?

#144
post #89

Interesting, I'm of the first kind, who uninstalled it quickly. I use ctrl-r a lot, though I have no issue remembering exact portions of the commands, but that may just be me. I'll give it another try. In the same vein as ripgrep (rg), I recommand the author (and everybody else) to give fd-find (fd) a try as a replacement to find. It's much, much faster (multithreaded search), and has better defaults to use from the…

I loveeee fd! About the only time I reach for find is if I need to do something with printf.

I’ve noticed a bunch of CLI tools recently released written in rust that are along this same line of being snappy and well-written. Fclones, ripgrep, paru, fd, exa, to name a few. This probably has more to do with the type of developers the rust platform attracts, rather than the language itself (many awesome tools have been written in go recently as well). But yea, devs who have an interest in Linux and command line tools tend to be great IMO :)

Re: So you've installed `fzf` – now what?

#145
post #110

Maybe I'm just getting old, but I found most of the animations in this article to go too fast. I couldn't tell what was happening, couldn't tell what I was supposed to be looking at.

okay ignore everything you saw and just conceptualize:

1) list of text 2) input to filter the list down. see: list gets tinier

Re: So you've installed `fzf` – now what?

#146

I wish we still had Perl one liners since it is installed everywhere vi and gawk is installed. I’ve never seen fzf in the wild.

I know, I am so used to ending up on different servers, I am worried about installing this on my own workstation, and getting used to it!

I find myself getting tripped up even with zsh missing.

Re: So you've installed `fzf` – now what?

#147
post #14

Earlier quoted context omitted.

You open Total Commander in that folder, press Alt+F7, put your string into the lower search box and press search. It will give you the list of matching files, with F3 available for quick preview; then you right click the file you need and choose "Open with VS Code" from the context menu. Sadly, you don't get the "context" (the content of actual matches) out of the box, you'll have to resort to double-tapping F3 whil…

I appreciate your answer but the whole point is to do everything from the command line. If I need to use another application, I can just open VS Code in the directory and search from there directly. In the article, they provide this: >rg . | fzf | cut -d ":" -f 1 What would be the easy windows equivalent of > cut -d ":" -f 1 ??

cut is a part of git for windows. It should be inside "c:\Program Files\Git\usr\bin\" folder. So after adding this folder to your path `rg . | fzf | cut -d ":" -f 1` should work. However I wasn't able to actually use that to open that file in vscode or vim because the application started immediately without waiting to pick a file ...

Re: So you've installed `fzf` – now what?

#148
post #64
post #50

I’ve never used fzf before and live in a shell all day, but the capabilities shown in the article doesn’t seem very useful to me. Am I missing something? For Ctrl+R, how many times are people running similar variants of commands that they 1) don’t know what they typed and 2) didn’t think to simplify their workflow to not be running duplicated commands? For Alt+C, are peoples’ file and directory layouts such a mess th…

For Ctrl+R, suppose you ran 'curl' against a bunch of API endpoints on a single domain name 2 months ago. I can now easily find one without knowing too much detail by fuzzy searching curl+part_of_domain_name+part_of_path. For Alt+C, yes files and directories are often a huge mess. It may be no fault of your own. Maybe you're working with a giant legacy codebase or digging into node_modules. Now you can type 'vim Alt+…

I usually do a `history | grep something | grep somethingelse` to find stuff in my history

Re: So you've installed `fzf` – now what?

#149

I love fuzzy shell history. Game changer in terms of shell productivity. I use atuin[0] instead of fzf as I find the experience a bit nicer and it has history backups built in (disclaimer, I am a maintainer) Some of our users still prefer fzf because they are used to how it fuzzy finds, but we're running an experiment with skim[1] which allows us to embed the fuzzy engine without much overhead - hopefully giving them…

If that's your use case, here's another game changer (one line bashrc change to make bash_history changes immediately, rather than upon shell exit, e.g. when you end your tmux session): https://web.archive.org/web/20090815205011/http://www.cuberi...

Oh wow thank you for this.

Re: So you've installed `fzf` – now what?

#150

Earlier quoted context omitted.

I also had a rather noticeable delay when launching atuin. As it turns out, this was because it checked for an update every time it launched! You can disable that update check: add a ` update_check = false` to your `~/.config/atuin/config.toml` [1]. That made the delay pretty much disappear for me. [1]: https://atuin.sh/docs/config/#update_check

We actually fixed the delay issue, but since you disabled update checking you wouldn't have known to update! It was quite annoying so we're sorry for that

Oh, it's nice you fixed it, thanks! And don't worry, I updated atuin, as it's in my distro's repository (which is why I wasn't worried about disabling the update check).
Post reply on HN