130
GitHub - bling/fzf.el: A front-end for fzf
source link: https://github.com/bling/fzf.el
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
fzf.el
An Emacs front-end for fzf.
installation
fzf.el can be installed through MELPA.
usage
fzf.el comes with some example commands to try out
M-x fzf
M-x fzf-directory
M-x fzf-switch-buffer
M-x fzf-find-file
M-x fzf-find-file-in-dir
M-x fzf-git
M-x fzf-git-files
M-x fzf-hg
M-x fzf-projectile
M-x fzf-git-grep
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.
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 exciting:
(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
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK