• Stars
    star
    185
  • Rank 208,318 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created over 10 years ago
  • Updated about 8 years ago

Reviews

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

Repository Details

fzz makes your command line interactive!

fzz Build Status

Do one thing, do it well — multiple times!

fzz allows you to change the input of a single command interactively. Have a look and pay close attention to the bee's knees here:

fzz-gif-cast2

Installation

Current version: 1.1.0

Download the binaries

Download the current release for your platform and copy the fzz binary to your $PATH.

Compile from source

Make sure you have Go installed. Then install fzz from source:

go get github.com/mrnugget/fzz

Usage

The general usage pattern is this:

fzz [command with {{}} placeholder]

Example: using fzz and grep to search through all *.go files in the current directory.

fzz grep {{}} *.go

Running this presents you with a prompt that allows you to change what grep will use as its search pattern by replacing {{}}.

After every input change fzz will rerun grep with the new input and show you what grep wrote to its STDOUT or, hopefully not, to its STDERR.

Once you're happy with the presented results simply press return to quit fzz and have the results printed to STDOUT.

Since the results will be printed to STDOUT you can use fzz with pipes:

fzz grep {{}} *.go | head -n 1 | awk -F":" '{print $1}'

fzz buffers its STDIN and passes it on to the specified command. That means you can put pipes all around it:

grep 'func' *.go | fzz grep {{}} | head -n 1

If you want to change the placeholder, you can do that by specifying it with the environment variable FZZ_PLACEHOLDER:

FZZ_PLACEHOLDER=%% fzz grep %% *.go

Usage Examples

Searching with ag

Use fzz to search through your current directory with the_silver_searcher interactively:

fzz ag {{}}

fzz and find for interactive file search

We can combine find and fzz to interactively search for files that match our input pattern:

fzz find ./Documents -iname "*{{}}*"

Use it in Vim to grep through your project

Use it as interactive search in Vim by setting it to grepprg:

:set grepprg=fzz\ ag\ --nogroup\ --nocolor\ \{\{\$*}\}

Then use :grep <searchterm> in Vim to start it. fzz will then fill the quickfix list with its results.

Use fzz.vim for more flexibility and features.

Interactively search files and open the results in your editor

Put this in your shell config and configure it to use your favorite editor:

vimfzz() {
  vim $(fzz ag {{}} | awk -F":" '{print $1}' | uniq)
}

TODO

  • Maybe change how fzz is printing its output to the TTY: instead of clearing the screen, jump to the first line, right after the input and rewrite the visible lines (padded so that all the columns are used and the previous output is not visible anymore)
  • Maybe selection of a line with Ctrl-J and Ctrl-K and the only print the selected line.

Contributing

Go ahead and open a issue or send a pull request. Fork it, branch it, send it.

Contributors

Thanks to ebfe for fixing a ton of bugs, adding features and offering suggestions!

License

MIT, see LICENSE

More Repositories

1

opencv-haar-classifier-training

Learn how to train your own OpenCV Haar classifier
Perl
729
star
2

vimconfig

My ~/.vim folder
Vim Script
81
star
3

scheme_x86

Writing a Scheme to x86 compiler by following Abdulaziz Ghuloum's "An Incremental Approach to Compiler Construction"
Scheme
63
star
4

dotfiles

My dotfiles, including configuration for zsh, tmux, psql
Shell
59
star
5

watchgopher

Watch a directory for changes
Go
54
star
6

helles

A prototype of a web server, using master-worker architecture, written in C.
C
40
star
7

virtual_brainfuck_machine

Companion repository for a blog post about Brainfuck, interpreters and VMs
Go
36
star
8

monkeylang

Official website for Monkey
SCSS
22
star
9

sceem

A small, simple and incomplete Lisp/Scheme interpreter written in Ruby
Ruby
12
star
10

data_structures

Implementations of common data structures in C
C
10
star
11

risp

A playground on which I hack on an incredibly tiny Lisp interpreter to learn Rust
Rust
8
star
12

windowcenter

GNOME extension to resize window to ~80% and center
JavaScript
7
star
13

tree-sitter-tucan

Tree-sitter parser for Tucan
C
6
star
14

tree-sitter-tucanir

Tree-sitter parser for Tucan IR
C
6
star
15

anygood

Was the movie any good? Check the ratings from different sites!
Ruby
5
star
16

ziggy

Zig playground
Zig
5
star
17

arm64-experiments

Just trying to see what it takes to cross-compile ARM64 assembly on x86-64 Linux and macOS
Makefile
3
star
18

sicp

My solutions (and attempts thereof) to the SICP exercises
Racket
3
star
19

vim-fzz

Use fzz and the_silver_searcher in Vim as an interactive search
Vim Script
2
star
20

pg_hello_world

pg_hello_world - A small example extension for PostgreSQL, written in C
C
1
star
21

emacs.d

Emacs configuration of a Vim lover
Emacs Lisp
1
star
22

non-native-fullscreen

Experiment, trying to get non-native fullscreen mode to work in an app
Swift
1
star
23

micktagger

Command line tool to tag files written in ruby
Ruby
1
star
24

testing-nextjs

Testing Next.js on Netlify, trying to figure out why prefetch doesn't work
TypeScript
1
star