Skip to content
(another) Fuzzy file finder for the command line
Branch: master
Clone or download
hugows Merge pull request #7 from baileyn/master
Fixed compilation error in runcmd_test.go, fmt was never used
Latest commit 838e7a6 Jul 15, 2015

happyfinder Build Status

hf is a command line utility to quickly find files and execute a command - something like Helm/Anything/CtrlP for the terminal. It tries to find the best match, like other fuzzy finders (Sublime, ido, Helm).

Here is it in action:

happyfinder on osx

If you have any suggestions, please open an issue.

Similar projects

This project wasn't implemented as an improvement to any of the projects below - I only knew about the text editor plugins (Anything, Helm, CtrlP, Sublime's native matching...). I wanted something similar to that for the command line, and a reason to use termbox-go, a great library for creating terminal-based apps.

Those projects take the elegant route - the Unix way - in the sense they don't reimplement the "find files recursively" part. I didn't consider that route because I wanted hf to work in the Windows prompt as well.


If you have Go configured in your system, you should be able to install (and update) happyfinder with the command:

go get -u


The basic command is:

  hf [path] [command]

The default path is the current folder.
The default command is the first valid of $GIT_EDITOR, $EDITOR, or vim 
(subl on Windows).

To find in your git project, use:

  hf -git [command]

 (if -git is provided, then next argument (optional) is assumed to be a command)

If the binary name is 'hfg', the -git option is assumed.
This was done because Windows users have no easy way of creating command aliases.

A -cmd=<yourcmd> option is provided to simplify aliases. For example, I defined 
iga (interactive git add) like this:

alias iga='hf -cmd="git add"'

    hf -git
    hf -git vim
    hf ~/go/src/
    hfg rm
    hf . rm

Inside the app:
    a-z0-9      Edit input string (those also work: backspace/C-a/C-e/C-k/Home/End)
    Up/down     Move cursor to next file
    Space       Toggle mark for current file and move to next
    C-t         Toggle mark for all files 
    C-s         Toggle "run command in shell"
    TAB         Jump to edit command (and back)
    RET         Run command
    ESC         Quit

When editing the command, the string $FILES is special and will
replaced by the select (or marked) files, properly quoted.
You can’t perform that action at this time.