• Stars
    star
    328
  • Rank 127,354 (Top 3 %)
  • Language
    Emacs Lisp
  • License
    GNU General Publi...
  • Created almost 9 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A front-end for fzf

fzf.el MELPA

An Emacs front-end for fzf.

demo

installation

fzf.el is available on MELPA.

Below is an illustrative use-package configuration of fzf.el showing all available customizations and their default values.

Note: This package does not set default keybindings.

(use-package fzf
  :bind
    ;; Don't forget to set keybinds!
  :config
  (setq fzf/args "-x --color bw --print-query --margin=1,0 --no-hscroll"
        fzf/executable "fzf"
        fzf/git-grep-args "-i --line-number %s"
        ;; command used for `fzf-grep-*` functions
        ;; example usage for ripgrep:
        ;; fzf/grep-command "rg --no-heading -nH"
        fzf/grep-command "grep -nrH"
        ;; If nil, the fzf buffer will appear at the top of the window
        fzf/position-bottom t
        fzf/window-height 15))

usage

fzf.el comes with a number of useful commands:

Using FZF_DEFAULT_COMMAND:

  • M-x fzf
  • M-x fzf-directory

Searching for files:

  • M-x fzf-find-file
  • M-x fzf-find-file-in-dir
  • M-x fzf-recentf

Project-aware search:

  • M-x fzf-git
  • M-x fzf-git-files
  • M-x fzf-git-grep
  • M-x fzf-hg
  • M-x fzf-projectile

Grep:

Note: fzf-grep-*-with-narrowing functions launch an interactive fzf/grep-command instead of using fuzzy filtering. See the fzf advanced documentation for more details.

  • M-x fzf-grep
  • M-x fzf-grep-dwim
  • M-x fzf-grep-in-dir
  • M-x fzf-grep-with-narrowing
  • M-x fzf-grep-dwim-with-narrowing
  • M-x fzf-grep-in-dir-with-narrowing

Using input from Emacs:

  • M-x fzf-switch-buffer

define custom functions

fzf.el exposes functions to let you interface with fzf however you'd like:

  • fzf-with-command (command action &optional directory as-filter initq): Run fzf on the output of a shell command.
    • command: The shell command whose output is passed to fzf.
    • action: A function that handles the result of fzf (e.g. open a file, switch to a buffer, etc.). This package ships with two default actions that can handle opening a file and opening a file at a specific line.
    • directory: Directory to execute fzf in.
    • as-filter: If non-nil, use command as the filter instead of fzf's fuzzy filtering. See fzf-grep-*-with-narrowing functions for example usages.
    • initq: If as-filter is non-nil, initq will be used as the value for the --query option. If as-filter is nil, this does nothing.
  • 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.

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

GPL3

More Repositories

1

vim-bufferline

super simple vim plugin to show the list of buffers in the command bar
Vim Script
490
star
2

dotvim

lean & mean vim distribution
Vim Script
429
star
3

dotemacs

emacs configuration for vim users
Emacs Lisp
260
star
4

minivimrc

a tiny vimrc to be used primarily for troubleshooting plugins
Vim Script
147
star
5

evil-visualstar

Start a * or # search from the visual selection
Emacs Lisp
74
star
6

evil-jumper

jump like vimmers do!
Emacs Lisp
55
star
7

emacs-evil-bootstrap

the quickest way to trying out vim in emacs
Emacs Lisp
52
star
8

pt.el

An emacs front-end for Pt, the Platinum Searcher
Emacs Lisp
40
star
9

dotfiles

here be dragons
Shell
10
star
10

dependencypropertyweaver

An MSBuild task that leverages Mono.Cecil to use post-build IL weaving to automatically convert auto-properties to dependency properties.
C#
7
star
11

Ping.Pong

A fast and lean Twitter client written Silverlight, For Developers, By Developers
C#
5
star
12

AdvancedIocTechniques

The code/slides that I used for my presentation about advanced IoC techniques at Code Camp NYC 2012.
C#
3
star
13

MessageQueuePerfTest

Simple test project for measuring roundtrip performance for sending durable messages with miscellaneous message queuing systems.
C#
3
star
14

pingpong.js

JavaScript
3
star
15

AspectCastle

A lightweight AOP framework built on top of Castle DynamicProxy.
C#
3
star
16

FontSampler

2
star
17

XmlCommentShrink

Shrink those XML comment headers on class, methods, properties, etc.
C#
2
star
18

msbuild-demo

2
star
19

reduxify

JavaScript
2
star
20

AOPDemo

C#
2
star
21

moneynode

JavaScript
2
star
22

.spacemacs.d

Emacs Lisp
2
star
23

ResharperStaticResource

A sample test project where Resharper's code analysis incorrectly flags XAML resources as missing when they are defined using a derived ResourceDictionary.
C#
2
star
24

bling.github.io

HTML
1
star
25

colorknit

JavaScript
1
star
26

moolah

Ruby
1
star