McFly replaces your default ctrl-r
Bash history search with an intelligent search engine that takes into account
your working directory and the context of recently executed commands. McFly's suggestions are prioritized
in real time with a small neural network.
TL;DR: an upgraded ctrl-r
for Bash whose history results make sense for what you're working on right now.
- Rebinds
ctrl-r
to bring up a full-screen reverse history search prioritized with a small neural network. - Augments your shell history to track command exit status, timestamp, and execution directory in a SQLite database.
- Maintains your normal Bash history file as well so that you can stop using McFly whenever you want.
- Unicode support throughout.
- Includes a simple action to scrub any history item from the McFly database and your shell history files.
- Designed to be extensible for other shells in the future.
- Written in Rust, so it's fast and safe.
The key feature of McFly is smart command prioritization powered by a small neural network that runs in real time. The goal is for the command you want to run to always be one of the top suggestions.
When suggesting a command, McFly takes into consideration:
- The directory where you ran the command. You're likely to run that command in the same directory in the future.
- What commands you typed before the command (e.g., the command's execution context).
- How often you run the command.
- When you last ran the command.
- If you've selected the command in McFly before.
- The command's historical exit status. You probably don't want to run old failed commands.
- Install the tap:
brew tap cantino/mcfly https://github.com/cantino/mcfly
- Install
mcfly
:brew install mcfly
- Add the following to your
~/.bashrc
file:if [[ -f "$(brew --prefix)/opt/mcfly/mcfly.bash" ]]; then source "$(brew --prefix)/opt/mcfly/mcfly.bash" fi
- Run
. ~/.bashrc
or restart your terminal emulator.
- Remove
mcfly
:brew uninstall mcfly
- Remove the tap:
brew untap cantino/mcfly
- Remove the lines you added to
~/.bashrc
.
- Download the latest release from GitHub.
- Install to a location in your
$PATH
. (For example, you could create a directory at~/bin
, copymcfly
to this location, and addexport PATH="$PATH:$HOME/bin"
to your.bashrc
.) - Copy
mcfly.bash
to a known location. - Add the following to your
~/.bashrc
file:if [[ -f /path/to/mcfly.bash ]]; then source /path/to/mcfly.bash fi
- Run
. ~/.bashrc
or restart your terminal emulator.
- Install Rust 1.29 or later
- Run
git clone https://github.com/cantino/mcfly
andcd mcfly
- Run
cargo install --path .
- Ensure
~/.cargo/bin
is in your$PATH
. - Add the following to your
~/.bashrc
file:if [[ -f /path/to/mcfly.bash ]]; then source /path/to/mcfly.bash fi
- Run
. ~/.bashrc
or restart your terminal emulator.
To avoid McFly's UI messing up your scrollback history in iTerm2, make sure this option is unchecked:
- Add a screencast to README.
- Learn common command options and autocomplete them in the suggestion UI?
- Sort command line args when coming up with the template matching string.
- Possible prioritization improvements:
- Cross validation & explicit training set selection.
- Learn command embeddings
cargo test
- Edit
Cargo.toml
and bump the version. git tag vx.x.x
git ci -m 'Bumping to vx.x.x'
git push origin head --tags
- Let the build finish.
- Edit the new Release on Github.
- Edit
pkg/brew/mcfly.rb
and update the version and SHAs. (shasum -a 256 ...
)