Live data from Hacker News

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

andrew-quinn.me

231–240 of 292 posts

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

#231
post #9

So I might aswell ask here: I want to search for a string using ripgrep, select one of the files from the result list using FZF and then open the selected file with VS code. > rg . | fzf How do I do this on windows (NOT Linux)?? *Note:* Assume I already have ripgrep, FZF & VS Code installed.

Something very close to this example is in the fzf “advanced” documentation at https://github.com/junegunn/fzf/blob/master/ADVANCED.md#usin...

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

#232
> You get only one preview, so if you miss that exact match by even one character, you’re on a wild goose chase

Which has done wonders for my memory :D

(You _can_ cycle through past entries, but will check this out as list does sound way better + the menus people are describing here sound interesting)

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

#233
post #201

The meaning of find . '/' Was not immediately apparent to me. It will first search the current directory, then search from the root directory of the filesystem. This is useful (beyond just `find` which is implicitly `find .`) because it will turn up local results quickly and global results eventually.

I actually did not catch myself that it has that two-tiered behavior. That's fascinating! Maybe I would have found nginx faster if I had reflexively hopped to /etc first.

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

#235
post #201

The meaning of find . '/' Was not immediately apparent to me. It will first search the current directory, then search from the root directory of the filesystem. This is useful (beyond just `find` which is implicitly `find .`) because it will turn up local results quickly and global results eventually.

Same as:

    find . /
Don't get why there's quoting here.

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

#236
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…

>`fd abc` is equivalent to `find. -iname 'abc'`

If you don't want to install a tool just for this:

    fs() { find -iname '*'"$1"'*' ; }
I don't really have big directories where speed would be a benefit, so haven't tried `fd` yet. I do use `ripgrep` but mostly for its features (like default recursive search respecting .gitignore, `-r` option, etc) over speed benefits.

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

#237

Am I the only one that tried fzf as a replacement to the default Ctrl+R behavior, then switched back? I'm perfectly satisfied with the default Ctrl+R functionality, to the point that fzf seemed to add visual clutter without any value. I guess I was never let down by inverse search. Context: I'm using Linux and doing SWE and SRE work, and constantly live in the terminal.

I don't like the `Ctrl+r` interface. Instead, I use these settings in `.inputrc`. Type the command I want and use arrow keys (I prefer matching from start of the command, but you can match anywhere too).

    # use up and down arrow to match search history based on typed starting text
    "\e[A": history-search-backward
    "\e[B": history-search-forward
    
    # if you prefer to search anywhere in the command
    "\e[A":history-substring-search-backward
    "\e[B":history-substring-search-forward

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

#238

Earlier quoted context omitted.

i love and daily-drive fish, but i don’t think fish does everything fzf does. did you stop reading the article at ctrl-r?

I like this: https://github.com/PatrickF1/fzf.fish It's one of the few packages that I think genuinely enhance fish versus merely adding a bunch of cruft.

That's still the only fish plugin I have installed.

alt+ctrl+f and ctrl+r are indispensable.

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

#239
I love fzf for one-liners. Simple pattern: a command gives you everything, pipe it to fzf so that you can pick one, then pipe that to a command to switch to it.

  alias kctx='kubectl config get-contexts -oname | fzf | xargs kubectl config use-context'

  alias prv="gh pr list | fzf | awk -F ' ' '{print $1}' | xargx gh pr view -w"
Amazing stuff.

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

#240

Earlier quoted context omitted.

Fuzzy history is nice, but the real game changer for me was the ability to pretty much stop remembering paths in big projects. The default keybindings provide the Ctrl-T shortcut to insert a path/filename on the command line using fuzzy search and Alt-C to fuzzy-cd. No more tedious completion - just search + enter.

Same thing with Emacs with Projectile. I can't believe people still using a tree view of a deeply nested project and clicking though directories and finally finding a file. I am not willing to type more than a few characters for any file in the project. Fuzzy finding with quick narrowing FTW.

What I really want is orderless[1] searching of my vterm shell history. That would be a game changer.

https://github.com/oantolin/orderless

Post reply on HN