This fork also needs https://github.com/rejeep/f.el and https://github.com/magnars/dash.el installed. You'll need https://github.com/abo-abo/swiper/ installed to use functions that use counsel
; I plan to eventually make all the functions use that, so install that as well.
To install this package itself, just clone the repository and use load-file
on fzf.el
.
An Emacs front-end for fzf.
fzf.el can be installed through MELPA.
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 resultsfzf-with-command (command action &optional directory)
: run a shell command and directly pass to fzf. An optimization on top offzf-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 defaultFZF_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)))
GPL3