Seeking co-maintainers: I don't have much time to maintain this project these days. If someone would like to jump in and become a co-maintainer, it would be appreciated!
McFly replaces your default ctrl-r shell 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 where history results make sense for what you're working on right now.
- Rebinds
ctrl-rto 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 shell 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.
- You can type
%to match any number of characters when searching.
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
-
Install
mcfly:brew install cantino/mcfly/mcfly
-
Add the following to the end of your
~/.bashrc,~/.zshrc, or~/.config/fish/config.fishfile:Bash:
eval "$(mcfly init bash)"
Zsh:
eval "$(mcfly init zsh)"
Fish:
mcfly init fish | source
-
Run
. ~/.bashrc/. ~/.zshrc/source ~/.config/fish/config.fishor restart your terminal emulator.
- Remove
mcfly:brew uninstall mcfly
- Remove the tap:
brew untap cantino/mcfly
- Remove the lines you added to
~/.bashrc/~/.zshrc/~/.config/fish/config.fish.
-
Update the ports tree
sudo port selfupdate
-
Install
mcfly:sudo port install mcfly
-
Add the following to the end of your
~/.bashrc,~/.zshrc, or~/.config/fish/config.fishfile, as appropriate:Bash:
eval "$(mcfly init bash)"
Zsh:
eval "$(mcfly init zsh)"
Fish:
mcfly init fish | source
-
Run
. ~/.bashrc/. ~/.zshrc/source ~/.config/fish/config.fishor restart your terminal emulator.
- Remove
mcfly:sudo port uninstall mcfly
- Remove the lines you added to
~/.bashrc/~/.zshrc/~/.config/fish/config.fish.
-
curl -LSfs https://raw.githubusercontent.com/cantino/mcfly/master/ci/install.sh | sh -s -- --git cantino/mcfly -
Add the following to the end of your
~/.bashrc,~/.zshrc, or~/.config/fish/config.fishfile, respectively:Bash:
eval "$(mcfly init bash)"
Zsh:
eval "$(mcfly init zsh)"
Fish:
mcfly init fish | source
-
Run
. ~/.bashrc/. ~/.zshrc/source ~/.config/fish/config.fishor restart your terminal emulator.
-
Download the latest release from GitHub.
-
Install to a location in your
$PATH. (For example, you could create a directory at~/bin, copymcflyto this location, and addexport PATH="$PATH:$HOME/bin"to your.bashrc/.zshrc, or runset -Ua fish_user_paths "$HOME/bin"for fish.) -
Add the following to the end of your
~/.bashrc,~/.zshrc, or~/.config/fish/config.fishfile, respectively:Bash:
eval "$(mcfly init bash)"
Zsh:
eval "$(mcfly init zsh)"
Fish:
mcfly init fish | source
-
Run
. ~/.bashrc/. ~/.zshrc/source ~/.config/fish/config.fishor restart your terminal emulator.
-
Run
git clone https://github.com/cantino/mcflyandcd mcfly -
Run
cargo install --path . -
Ensure
~/.cargo/binis in your$PATH. -
Add the following to the end of your
~/.bashrc,~/.zshrc, or~/.config/fish/config.fishfile, respectively:Bash:
eval "$(mcfly init bash)"
Zsh:
eval "$(mcfly init zsh)"
Fish:
mcfly init fish | source
-
Run
. ~/.bashrc/. ~/.zshrc/source ~/.config/fish/config.fishor restart your terminal emulator.
Install by Zinit
-
Add below code to your zshrc.
zinit ice lucid wait"0a" from"gh-r" as"program" atload'eval "$(mcfly init zsh)"' zinit light cantino/mcfly
-
It will download mcfly and install for you.
-
$(mcfly init zsh)will be executed after prompt
To avoid McFly's UI messing up your scrollback history in iTerm2, make sure this option is unchecked:
A number of settings can be set via environment variables. To set a setting you should add the following snippets to your ~/.bashrc / ~/.zshrc / ~/.config/fish/config.fish.
To swap the color scheme for use in a light terminal, set the environment variable MCFLY_LIGHT.
bash / zsh:
export MCFLY_LIGHT=TRUEfish:
set -gx MCFLY_LIGHT TRUETip: on macOS you can use the following snippet for color scheme to be configured based on system-wide settings:
bash / zsh:
if [[ "$(defaults read -g AppleInterfaceStyle 2&>/dev/null)" != "Dark" ]]; then
export MCFLY_LIGHT=TRUE
fiBy default Mcfly uses an emacs inspired key scheme. If you would like to switch to the vim inspired key scheme, set the environment variable MCFLY_KEY_SCHEME.
bash / zsh:
export MCFLY_KEY_SCHEME=vimfish:
set -gx MCFLY_KEY_SCHEME vimTo enable fuzzy searching, set MCFLY_FUZZY to an integer. 0 is off; higher numbers weight toward shorter matches. Values in the 2-5 range get good results so far; try a few and report what works best for you!
bash / zsh:
export MCFLY_FUZZY=2fish:
set -gx MCFLY_FUZZY 2To change the maximum number of results shown, set MCFLY_RESULTS (default: 10).
bash / zsh:
export MCFLY_RESULTS=50fish:
set -gx MCFLY_RESULTS 50To change interface view, set MCFLY_INTERFACE_VIEW (default: TOP).
Available options: TOP and BOTTOM
bash / zsh:
export MCFLY_INTERFACE_VIEW=BOTTOMfish:
set -gx MCFLY_INTERFACE_VIEW BOTTOMTo disable the menu interface, set the environment variable MCFLY_DISABLE_MENU.
bash / zsh:
export MCFLY_DISABLE_MENU=TRUEfish:
set -gx MCFLY_DISABLE_MENU TRUETo change the sorting of results shown, set MCFLY_RESULTS_SORT (default: RANK).
Possible values RANK and LAST_RUN
bash / zsh:
export MCFLY_RESULTS_SORT=LAST_RUNfish:
set -gx MCFLY_RESULTS_SORT LAST_RUNMcFly stores its SQLite database in the standard location for the OS. On OS X, this is in ~/Library/Application Support/McFly and on Linux it is in $XDG_DATA_DIR/mcfly/history.db (default would be ~/.local/share/mcfly/history.db). For legacy support, if ~/.mcfly/ exists, it is used instead.
If you have a very large history database and you notice that McFly launches slowly, you can set MCFLY_HISTORY_LIMIT to something like 10000 to limit how many records are considered when searching. In this example, McFly would search only the latest 10,000 entries.
McFly currently doesn't parse or use HISTTIMEFORMAT.
- 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
Contributions and bug fixes are encouraged! However, we may not merge PRs that increase complexity significantly beyond what is already required to maintain the project. If you're in doubt, feel free to open an issue and ask.
cargo test
- Edit
Cargo.tomland bump the version. - Edit CHANGELOG.txt
- Run
cargo clippyandcargo fmt. - Recompile (
cargo build). git add -pgit ci -m 'Bumping to vx.x.x'git tag vx.x.xgit push origin head --tags- Let the build finish.
- Edit the new Release on Github.
- Edit
pkg/brew/mcfly.rband update the version and SHAs. (shasum -a 256 ...) - Edit
../homebrew-mcfly/pkg/brew/mcfly.rbtoo. cp pkg/brew/mcfly.rb ../homebrew-mcfly/pkg/brew/mcfly.rb- Compare with
diff ../homebrew-mcfly/pkg/brew/mcfly.rb ../mcfly/pkg/brew/mcfly.rb ; diff ../homebrew-mcfly/HomebrewFormula/mcfly.rb ../mcfly/HomebrewFormula/mcfly.rb git add -p && git ci -m 'Update homebrew' && git pushcd ../homebrew-mcfly && git add -p && git ci -m 'Update homebrew' && git push && cd ../mcflycargo publish