mcfly
Suggest and recall previously used commands
TLDR
Print the mcfly integration code for the specified shell
Search the history for a command, with 20 results
Add a new command to the history
Record that a directory has moved and transfer the historical records from the old path to the new one
Train the suggestion engine (developer tool)
Display help for a specific subcommand
SYNOPSIS
mcfly is typically used interactively as a key binding (e.g., Ctrl+R).
For non-interactive use: mcfly [OPTIONS] [--command <SEARCH_STRING>]
PARAMETERS
--fuzzy
Enables or disables fuzzy matching for search queries.
--depth
Searches history up to N entries deep, limiting the scope of the search.
--sort-mode
Sets the sorting order for results. Modes include relevance (default), last_used, last_used_reverse, length, and length_reverse.
--filter-mode
Changes the action mode. Modes include search (default for interactive search) and delete (to delete selected entries).
--command
Runs mcfly in non-interactive mode, searching for the best match for the given STRING and printing it to standard output.
--history
Specifies an alternative history file to use instead of the default shell history file.
--disable-up-arrow
Prevents mcfly from binding the Up arrow key, useful if another binding or behavior is preferred.
--append-and-run
In non-interactive mode, appends the chosen command to the history and immediately executes it. Requires --command.
--session-id
Used internally by mcfly to manage history across multiple terminal sessions, helping to track context.
--help
Displays the help message and exits.
--version
Displays the version information and exits.
DESCRIPTION
mcfly is an intelligent, instant shell history search tool designed to replace the default Ctrl+R functionality in Bash and Zsh. It learns from your usage patterns, considering factors like frequently used commands, working directories, and command exit status, to provide more relevant search results. Unlike simple string matching, mcfly employs a small neural network to rank suggestions, making your history navigation faster and more intuitive. It offers full-text search, navigable results, and options to filter or delete history entries, significantly enhancing command-line productivity.
CAVEATS
Requires integration into shell's configuration (.bashrc, .zshrc) to function as a key binding.
May conflict with existing Ctrl+R or Up arrow keybindings if not configured carefully.
The learning model adapts over time, so initial results might not be perfectly optimized.
INSTALLATION AND SETUP
mcfly is typically installed via cargo (e.g., cargo install mcfly) or system package managers. For interactive use, it must be integrated into your shell's configuration file (e.g., .bashrc or .zshrc) by sourcing a setup script provided by the installation, which usually binds it to Ctrl+R.
NEURAL NETWORK FUNCTIONALITY
The core innovation of mcfly is its use of a tiny neural network, trained on your actual shell history data. This allows it to learn patterns and suggest commands based on context, frequency, and recent usage, providing more intelligent suggestions than simple text matching. It considers factors like the current working directory and command exit status to refine its recommendations.
HISTORY
mcfly was created by cantino and first released in 2018. It emerged to address the limitations of traditional shell history search by incorporating machine learning, specifically a small neural network. Its development focused on being a fast, user-friendly, and highly effective replacement for the common Ctrl+R shell binding, quickly gaining popularity for improving command-line workflow efficiency and context-aware suggestions.