xcapaldi / ezf

Emacs Fuzzy Finder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Emacs Fuzzy Finder

ezf-example-optimised.gif

Emacs Fuzzy Finder is like fzf but it leverages the power of your Emacs instance to filter and select candidates.

Use ezf as part of your piping and command substitutions to manually select and filter matches.

Here’s an example:

sudo dnf install $(dnf search emacs | ezf -f 0)

This will search Fedora’s package repository for anything with the word emacs in it – yielding over 100 results. The first column is then passed to ezf and you’re asked to filter and select candidates inside your own Emacs. The ones you select are sent back to the shell, and substituted into the call to dnf install. You can play with the crm-seperator regexp if you want to use a different character than ~,~ to separate multiple selections.

To better understand how it works, read Mikey Petersen’s original article on Fuzzy Finding with Emacs instead of fzf.

When making many selections, the completion buffer can become quite crowded. One option is to use the original repo with helm support. Another option might be to write a multiple completion framework similar to that done in citar. However for most use-cases, the default completion system works well.

Why a fork

This is a fork of Mikey Petersen’s original implementation at mickeynp/ezf. I created the fork initially to remove the dependency on the helm completion framework. Instead this version relies soley on the built-in completion frameworks/compatible frameworks. In particular it relies on completing-read-multiple. I’ve tested with Vertico with the Orderless completion style and with the default completion framework. I suspect it would work fine with MCT or Selectrum.

The bash script has also been converted to a posix-compliant shell script at the expense of losing -set o pipefail.

If ezf is invoked from a terminal external to emacs, the emacs frame will raise. However, I do not have a good method of returning the user to the original terminal after they make the selection in emacs. I tried using xdotool for this but it requires a dependency and wasn’t super reliable across different terminals.

sudo dnf install $(dnf search emacs | ezf -m -f 0)

How to Install

manual

  1. Git clone the repo (or download)
  2. Load ezf.el

straight.el

Alternatively if you use straight.el as your package manager, you can point it directly to the repository.

(straight-use-package
 '(ezf :type git :host github :repo "xcapaldi/ezf"))

straight.el + use-package

(use-package ezf
  :straight (ezf :type git :host github :repo "xcapaldi/ezf")
  :commands ezf)

Shell script

No matter the installation method for emacs, you need to put ezf somewhere in your PATH. Make sure you run emacs as a daemon or use server-start.

About

Emacs Fuzzy Finder

License:GNU General Public License v3.0


Languages

Language:Emacs Lisp 87.0%Language:Shell 13.0%