McFly

Replaces ctrl-r shell history search with a full-screen search ranked by a small neural network using directory, prior commands, and exit status.

install

McFly is a shell history search tool written in Rust. It rebinds ctrl-r in Zsh, Bash (version 3+), Fish, and PowerShell (version 7+) to open a full-screen reverse history search. Results are ranked in real time by a small neural network instead of by recency alone.

To support ranking, McFly records each command's exit status, timestamp, and execution directory in a SQLite database. The ranking takes into account the directory where a command was run, the commands typed before it, how often and how recently it was run, whether you selected it in McFly before, and its historical exit status, so old failed commands rank lower. Your normal shell history file is still maintained, so you can stop using McFly at any time. A built-in action removes a history item from both the McFly database and your shell history files.

Other capabilities include % as a wildcard in searches, Unicode support, optional fuzzy matching (MCFLY_FUZZY), and a vim key scheme (MCFLY_KEY_SCHEME=vim). You can also set a light color scheme, the number of results (MCFLY_RESULTS, default 30), top or bottom interface placement, and result sorting by rank or last run. mcfly dump writes history to stdout as JSON or CSV. It can filter by --since and --before timestamps and by regex with -r. It is aimed at developers and sysadmins who work in the terminal and rely on history recall. The README notes the project is looking for co-maintainers.

Installation

# via Homebrew
brew install mcfly
# via MacPorts
sudo port install mcfly
# via WinGet
winget install AndrewCantino.McFly

McFly full-screen history search

Alternatives & related tools

add a badge to your README

Maintain McFly? Show that it's featured on trmn. The badge links back to this page.

Featured on trmn
Markdown
[![Featured on trmn](https://www.trmn.sh/badge/mcfly.svg)](https://www.trmn.sh/tools/mcfly?utm_source=badge)
HTML
<a href="https://www.trmn.sh/tools/mcfly?utm_source=badge"><img src="https://www.trmn.sh/badge/mcfly.svg" alt="Featured on trmn" height="20"></a>