McFly
Intelligent shell history search with neural network.
Official WebsiteFeatures
Neural NetworkContext AwareShell IntegrationFuzzy Search
Replaces
historyInstallation
Homebrew
brew install mcflyPacman (Arch)
pacman -S mcflyCargo (Rust)
cargo install mcflyWhy use McFly?
McFly is an intelligent shell history search tool that learns from your behavior. Instead of showing the most recent commands, it uses machine learning to rank commands by relevance to your current context, making it faster and easier to find the command you need.
Neural Network Learning
McFly uses machine learning to understand your command patterns and preferences, continuously improving suggestions.
Context-Aware Search
Ranks commands based on your current directory, recent usage, and other contextual factors.
Fuzzy Search
Fast fuzzy matching for finding commands even when you don't remember the exact syntax.
Better Than Ctrl+R
Superior to the default history search with intelligent ranking and easier navigation.
Installation
Using Homebrew (macOS/Linux)
Installation
brew install mcflyUsing Cargo (Rust)
Installation
cargo install mcflyShell Integration Setup
Shell Setup
# For Bash, add to ~/.bashrc:
eval "$(mcfly init bash)"
# For Zsh, add to ~/.zshrc:
eval "$(mcfly init zsh)"
# For Fish, add to ~/.config/fish/config.fish:
mcfly init fish | source
# Then restart your shell or source your config
source ~/.bashrc # or ~/.zshrcVerify Installation
Verification
mcfly --version
# Check if integrated with your shell
echo $MCFLY_HOME # Should show McFly's data directoryBasic Usage
Searching History
Basic Search
# Open McFly search interface (replaces Ctrl+R)
Ctrl+R
# Or explicitly search for commands
mcfly search "git commit"
# Search with fuzzy matching
Ctrl+R
# Type partial command: gst
# McFly shows: git status, git stash, etc.Navigation and Selection
Navigation
# In McFly search interface:
Ctrl+R # Open search
Type: command # Fuzzy search
↑/↓ # Navigate results
Enter # Execute selected command
Esc # Cancel search
# Preview commands
Ctrl+O # Show more details about highlighted command
Tab # Select/deselect commands (multi-select)Learning from Your Habits
Learning Process
# McFly learns as you use it:
# 1. Every command execution is recorded
# 2. Usage patterns are analyzed
# 3. Suggestions are ranked based on:
# - Directory context
# - Recent usage frequency
# - Time patterns
# - Command success/failure
# The more you use it, the better suggestions become
# After a few weeks of normal usage, suggestions will be highly personalizedCommon Commands and Options
| Command/Option | Description | Example |
|---|---|---|
mcfly search | Search command history | mcfly search "git" |
mcfly init | Initialize shell integration | mcfly init bash |
--help | Show help information | mcfly --help |
--version | Show version information | mcfly --version |
MCFLY_HOME | Set data directory location | export MCFLY_HOME=~/.mcfly |
Practical Examples
Git Workflow Example
Git Workflow
# After using these commands several times:
git add .
git commit -m "Add feature"
git push
# Later, just press Ctrl+R and type:
Ctrl+R
git c
# McFly shows: git commit (at top, as it's most used in this context)
Ctrl+R
gp
# McFly shows: git push (learns your patterns)Directory-Aware Suggestions
Context-Aware Behavior
# When in your project directory:
Ctrl+R
npm
# McFly suggests: npm install, npm start, npm test
# When in a different project directory:
Ctrl+R
npm
# McFly suggests different npm commands based on what you usually do there
# The learning is context-aware per directoryComplex Command Recovery
Complex Commands
# You used a complex command weeks ago:
ffmpeg -i input.mp4 -c:v libx265 -crf 23 output.mp4
# Recover it without remembering exact syntax:
Ctrl+R
ffmpeg
# McFly shows your previous ffmpeg commands ranked by relevance
# Or search for partial pattern:
Ctrl+R
265
# Finds the HEVC encoding commandDeveloper Tools Integration
Development Tools
# Docker commands with context
Ctrl+R
docker run
# Shows your frequently used docker commands
# Kubernetes operations
Ctrl+R
kubectl apply
# Shows your kubectl patterns
# Python development
Ctrl+R
pytest
# McFly learns your testing patternsConfiguration and Customization
Environment Variables
Environment Setup
# Set McFly data directory
export MCFLY_HOME="$HOME/.config/mcfly"
# Configure history file location
export HISTFILE="$HOME/.history"
# Control number of results shown
export MCFLY_RESULTS=20
# Add to ~/.bashrc or ~/.zshrc
# These variables control McFly's behavior and data storageShell-Specific Configuration
Shell Config
# For Bash, customize in ~/.bashrc:
eval "$(mcfly init bash)"
# For Zsh, customize in ~/.zshrc:
eval "$(mcfly init zsh)"
# For Fish, customize in ~/.config/fish/config.fish:
mcfly init fish | source
# Keybinding customization (shell-specific)
# Bash: Use bind command
# Zsh: Use bindkey command
# Fish: Built-in keybinding setupImport Existing History
History Import
# McFly automatically imports your existing shell history on first run
# If you want to re-import or migrate:
mcfly import
# This helps bootstrap the machine learning model with your past commands
# After import, McFly learns patterns from your entire historyMcFly vs Traditional History Search
| Feature | Ctrl+R (Default) | fzf | McFly |
|---|---|---|---|
| Fuzzy search | No | Yes | Yes |
| Learning/Ranking | None | Frequency only | Neural network |
| Context awareness | No | No | Yes |
| Setup complexity | None | Moderate | Simple |
| Learning curve | None | Minimal | Minimal |
| Improves over time | No | No | Yes |
Tips
- •McFly automatically replaces the default Ctrl+R behavior, so no keybinding changes are needed
- •The neural network model improves significantly after 2-4 weeks of regular use, giving increasingly accurate suggestions
- •McFly learns per-directory patterns, so behavior in different projects becomes increasingly specialized
- •You can use Tab to select multiple commands at once, useful for batch operations
- •McFly stores command history in a database format, making it more reliable than plain text history files
- •Consider using McFly with other history tools like zsh-autosuggestions for a complementary workflow
- •If migration from fzf + history, McFly's context awareness makes it worth the switch for discovering commands you forgot about