A front-end for fzf
Branch: master
Clone or download
#1 Compare This branch is 2 commits ahead, 2 commits behind bling:master.
seenaburns Update readme for modular fzf
Adds example commands and explanation of how to use fzf.el for programming your own commands
Latest commit 499b532 Mar 5, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE initial commit Sep 19, 2015
README.md Update readme for modular fzf Mar 6, 2018
fzf.el Generalize fzf.el into a completion engine with fzf Mar 6, 2018

README.md

fzf.el MELPA

An Emacs front-end for fzf.

demo

installation

fzf.el can be installed through MELPA.

usage

fzf.el comes with some example commands to try out

  • M-x switch-buffer
  • M-x fzf-find-file
  • M-x fzf-find-file-in-dir
  • M-x fzf-recentf
  • M-x fzf-grep

But the real action is writing your own.

fzf.el exposes three functions:

  • fzf-with-entries (entries action &optional directory): run fzf, passing in an elisp list and running the function action with the user's selected results
  • fzf-with-command (command action &optional directory): run a shell command and directly pass to fzf. An optimization on top of fzf-with-entries so that the output does not have to be stored in emacs before sending to fzf anyway.
  • fzf-base (action &optional directory): run fzf with the user's default FZF_DEFAULT_COMMAND

Using these functions, it's easy to define your own commands that use fzf:

(defun fzf-example ()
  (fzf-with-entries
   (list "a" "b" "c")
   'print))

Or more exiciting: fzf-find-file

(defun fzf-find-file (&optional directory)
  (interactive)
  (let ((d (fzf/resolve-directory directory)))
    (fzf
    (lambda (x)
        (let ((f (expand-file-name x d)))
        (when (file-exists-p f)
            (find-file f))))
    d)))

license

GPL3