Integrate Mcfly with fzf to combine a solid command history database with a widely-loved fuzzy search UI

Overview

McFly fzf integration

Integrate McFly with fzf to combine a solid command history database with a widely-loved fuzzy search UI

Features:

  • Advanced history tracking and prioritization courtesy of McFly
  • Rebinds ctrl-r to use an fzf-based interface
  • Toggle options in fzf interface:
    • F1: Sort by time / neural network score
    • F2: Limit to commands run from current directory / any directory
    • F3: Filter by exit status: [Okay (zero) / Fail (non-zero) / Any]

Screenshot

Installation

  1. Install mcfly: Included with the mcfly-fzf binaries. Alternatively download mcfly release binary, or view other installation options

  2. Install fzf: Download binary, or view other installation options

  3. Install mcfly-fzf: Download binary
    Alternatively, install from source:

    cargo install --git https://github.com/bnprks/mcfly-fzf
    
  4. Make sure that mcfly, fzf, and mcfly-fzf are all added to your $PATH. Following instructions from McFly:

    For example, you could create a directory at ~/bin, copy mcfly to this location, and add export PATH="$PATH:$HOME/bin" to your .bashrc / .zshrc, or run set -Ua fish_user_paths "$HOME/bin" for fish.

  5. Add the following to the end of your ~/.bashrc, ~/.zshrc, or ~/.config/fish/config.fish file:

    Bash:

    eval "$(mcfly init bash)"
    eval "$(mcfly-fzf init bash)"

    Zsh:

    eval "$(mcfly init zsh)"
    eval "$(mcfly-fzf init zsh)"

    Fish:

    mcfly init fish | source
    mcfly-fzf init fish | source

Usage

  • Press ctrl-r to open search:
    • Type to search
    • Arrow keys to navigate up/down
    • Enter to select
    • F1/F2/F3 to adjust view settings
  • Respects the following environment variables
  • To delete history entries, run mcfly search manually

How it works

Overall:

  • mcfly-fzf imports the mcfly crate to access the database.
  • A per-session temporary json file stores the search setting toggles within and between searches.

What happens during ctrl-r:

  1. mcfly-fzf dump reads the mcfly sqlite database and prints the entry to stdout, where it is piped to fzf
  2. Toggling F1/F2/F3 in fzf runs mcfly-fzf toggle, which updates a temporary json file stored at $MCFLY_FZF_OPTS. Then mcfly-fzf dump runs again to re-populate the filtered results for fzf.
  3. After selecting a history item, mcfly-fzf select marks the item in the selected_commands table so that the McFly neural network can prioritize frequently-selected items.
You might also like...
git-cliff can generate changelog files from the Git history by utilizing conventional commits as well as regex-powered custom parsers.⛰️
git-cliff can generate changelog files from the Git history by utilizing conventional commits as well as regex-powered custom parsers.⛰️

git-cliff can generate changelog files from the Git history by utilizing conventional commits as well as regex-powered custom parsers. The changelog template can be customized with a configuration file to match the desired format.

Simple calculator REPL, similar to bc(1), with syntax highlighting and persistent history
Simple calculator REPL, similar to bc(1), with syntax highlighting and persistent history

eva simple calculator REPL, similar to bc(1), with syntax highlighting and persistent history installation Homebrew $ brew install eva crates.io $ car

An enhanced history(1) for bash
An enhanced history(1) for bash

history This is a replacement for the history builtin in bash. It has a couple of additional features that relative to the one included with bash: Con

🗄️ A simple (and safe!) to consume history of Client and Studio deployment versions.

🗄️ Roblox Version Archive A simple (and safe!) to consume history of Client and Studio deployment versions. About Parsing Roblox's DeployHistory form

Save cli commands and fuzzy find them later
Save cli commands and fuzzy find them later

crow - cli command memorizer What is crow? | Installation | Usage | FAQ What is crow? crow (command row) is a CLI tool to help you memorize CLI comman

Skim - Fuzzy Finder in rust!
Skim - Fuzzy Finder in rust!

Life is short, skim! Half of our life is spent on navigation: files, lines, commands… You need skim! It is a general fuzzy finder that saves you time.

A simple, modern fuzzy finder tool to run examples in a Cargo project.

cargo-rx cargo-rx is a simple, modern Runner for Examples in a Cargo project. This crate provides a single executable: rx. Basically anywhere you woul

Fuzzy Index for Python, written in Rust. Works like error-tolerant dict, keyed by a human input.

FuzzDex FuzzDex is a fast Python library, written in Rust. It implements an in-memory fuzzy index that works like an error-tolerant dictionary keyed b

A multi-page fuzzy launcher for your terminal, written in Rust.
A multi-page fuzzy launcher for your terminal, written in Rust.

fr33zmenu A multi-page fuzzy launcher for your terminal, written in Rust. Supports theming and multiple keybind schemes, including basic vim keybinds.

Releases(0.1.1)
Owner
null
McFly - fly through your shell history

McFly - fly through your shell history McFly replaces your default ctrl-r shell history search with an intelligent search engine that takes into accou

Andrew Cantino 4.8k Jan 7, 2023
Fuzzy a general fuzzy finder that saves you time in rust!

Life is short, skim! Half of our life is spent on navigation: files, lines, commands… You need skim! It is a general fuzzy finder that saves you time.

Jinzhou Zhang 3.7k Jan 8, 2023
🧠 A command-line utility for switching git branches more easily. Switch branches interactively or use a fuzzy search to find that long-forgotten branch name.

git-smart-checkout A git command extension for switching git branches more efficiently. About Interactively switch branches or fuzzy search for that f

Cezar Craciun 51 Dec 29, 2022
A hackable, minimal, fast TUI file explorer, stealing ideas from nnn and fzf.

xplr A hackable, minimal, fast TUI file explorer, stealing ideas from nnn and fzf. [Quickstart] [Features] [Plugins] [Documentation] [Upgrade Guide] [

Arijit Basu 2.6k Jan 1, 2023
🐢 Atuin replaces your existing shell history with a SQLite database, and records additional context for your commands

Atuin replaces your existing shell history with a SQLite database, and records additional context for your commands. Additionally, it provides optional and fully encrypted synchronisation of your history between machines, via an Atuin server.

Ellie Huxtable 4.6k Jan 1, 2023
Help Skelly to find bones, combine them to build his body back

Bones Collector Help Skelly to find bones, combine them to build his body back! Game made for the bevy Jam#2. Play it here in your browser: itch.io! R

Thomas 2 Nov 15, 2022
Integrate a Rust project with semantic-release

semantic-release-cargo semantic-release-cargo integrates a cargo-based Rust project with semantic-release. This solves two use cases: publishing to cr

null 5 Jan 16, 2023
A high-performance Rust library designed to seamlessly integrate with the Discord API.

Rucord - Rust Library for Discord API Interactions Note: This library is currently under development and is not yet recommended for production use. Ov

Coders' Collab 4 Feb 26, 2023
Transform jsx/tsx files to reactive views in js/ts to use in Web Components, insert into DOM or integrate with other libraries/frameworks

viewmill Features | Installation | Getting Started | Notes | Examples viewmill is aimed to create complex UIs from a simple form of JSX. It statically

apleshkov 6 Sep 4, 2023