Hacker News new | past | comments | ask | show | jobs | submit login
Fuzzy Finding with Emacs Instead of Fzf (masteringemacs.org)
90 points by signa11 on July 27, 2022 | hide | past | favorite | 14 comments



> Emacs has better fuzzy finding

With due respect to Mr. Petersen, and as an Emacs user myself, I really can't agree. When I fire up fzf I just type and generally without any thinking I get what I want. Emacs takes some configuration to get to that point; the built in flex completion is, for whatever reason, not as robust in my experience.

In fact, in my current config I've been using fzf (or really skim) for completion within Emacs, via fussy: https://github.com/jojojames/fussy


Is it just me or is Mickey Petersen on some crazy roll right now? It seems like every other day he's posting another blindingly clear and useful write up of some nook and cranny of Emacs that you'd either never considered the possibility of or at best only got round to daydreaming you'd one day try to figure out or implement?

> So that got me thinking. There’s no reason why you can’t use Emacs to do this instead of fzf! Emacs has better fuzzy finding and it’s the text editor you’re already using, so why not use Emacs?

Love it.

Also, as he says in the footer, this is available on Github: https://github.com/mickeynp/ezf


He's also a reasonably active participant in r/emacs which is great. I'm already pretty proficient in Emacs, and Emacs already comes with pretty solid documentation, but I bought his book "Mastering Emacs" anyway because I'm a fan of his writing and blog posts.


I look at his posts and dream to be that proficient Emacs user one day.

I'd imagine if he records a video of doing his daily work in Emacs, it probably feels like the Matrix.


While we're on the topic of finding stuff in Emacs, check out the `consult-ripgrep` [1] command from the Consult package by Daniel Mendler. Consult coupled with Orderless [2] package is a super power. You can even export the results (using Embark [3]) into a wgrep buffer, make edits on just the search results, and have them applied across the code base!

[1]: https://github.com/minad/consult#grep-and-find

[2]: https://github.com/oantolin/orderless

[3]: https://github.com/oantolin/embark


The `Emacs-wgrep` [1] package is what allows you to edit a standard Emacs grep buffer and have the specified changes applied to all the project's files. I just recently started using it, and it's extremely handy!

[1]: https://github.com/mhayashi1120/Emacs-wgrep


I've been using Helm for everything for years and have been reluctant to switch to the Consult, Embark, Marginalia etc ecosystem. Is it worth it?


One slight difference: fzf is cross platform, whereas I believe his solution is not.


Emacs is available on many platforms; why wouldn’t you think that this will work on all of them?


Should be as cross-platform as Emacs and Bash are: very cross-platform. And the Bash wrapper (ezf.sh for ezf.el) could probably be rewritten in say Powershell.

Fzf is written in C, and there's a Rust implementation called skim (sk).

Each of these seem very cross-platform. But the advantage this solution has is that you stay within the Emacs ecosystem with Emacs syntax/keybinds/colors etc.


I suppose I should have been clearer: The submission is on how to get fzf behavior in Emacs without using the various fzf related packages for Emacs.

Emacs is cross platform.

fzf is cross platform.

Presumably the fzf packages for Emacs are cross platform, but I haven't checked. If any of them are, then I can have the same setup for Windows and Linux (I use Emacs on both).

With this solution, I'd need to have a different script in Windows and Linux (I don't use WSL - Emacs works quite well without it). So by cross platform, I meant "Copy config from one platform to another and just have it work".


Umm, fzf is written in go, not C.


>Fzf is written in C

That would be fzy : https://github.com/jhawthorn/fzy


As the adage goes: Emacs is an Operating System with a somewhat decent text editor embedded.

This solution is just as portable as Emacs. Very, very portable.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: