LinuxCommandLibrary

navi

Browse and execute command-line snippets

TLDR

Browse through all available cheatsheets

$ navi
copy

Browse the cheatsheet for navi itself
$ navi fn welcome
copy

Print a command from the cheatsheet without executing it
$ navi --print
copy

Output shell widget source code (It automatically detects your shell if possible, but can also be specified manually)
$ navi widget [shell]
copy

Autoselect and execute the snippet that best matches a query
$ navi --query '[query]' --best-match
copy

SYNOPSIS

navi [OPTIONS]
navi [SUBCOMMAND] [ARGS]

PARAMETERS

--query <query>
    Prefills the interactive search with a specific query string, filtering cheatsheets.

--path <dir>
    Specifies additional directories where navi should look for cheatsheet files.

--finder <cmd>
    Defines the external fuzzy finder command to be used (e.g., fzf, skim).

--print
    Prints the selected command to standard output instead of executing it.

--exec
    Immediately executes the chosen command after selection (this is the default behavior).

--copy-to-clipboard
    Copies the selected command to the system clipboard.

--edit
    Opens the navi cheatsheet directory in the default text editor for quick modification.

repo
    A subcommand for managing cheatsheet repositories (add, browse, update, remove).

search <query>
    Performs a non-interactive search for commands matching the provided query.

info
    Displays comprehensive information about navi's configuration and paths.

DESCRIPTION

navi is an intuitive and interactive command-line interface (CLI) tool designed to help users quickly find, browse, and execute commands from curated cheatsheets. It aims to reduce the need for constant web searches or memorizing complex command syntax. navi integrates seamlessly with popular fuzzy finders like fzf or skim, providing a highly efficient search experience. Users can define their own custom cheatsheets in a simple plaintext format, or pull from publicly available repositories, including community-driven ones. This extensibility makes it a versatile tool for both individual command recall and team-wide knowledge sharing. Beyond just searching, navi allows for direct execution of selected commands, optionally filling in placeholder values interactively, thereby streamlining workflow and improving productivity for developers, system administrators, and anyone frequently using the terminal. Written in Rust, it offers fast performance and a robust user experience.

CAVEATS

While powerful, navi requires an external fuzzy finder like fzf or skim to be installed and accessible. The utility's effectiveness heavily relies on the quality and comprehensiveness of the cheatsheet files, which are often community-contributed or user-defined. For seamless execution of selected commands directly into the current shell, specific shell integration (e.g., functions in .bashrc or .zshrc) is typically required. Users should exercise caution when executing commands from untrusted cheatsheets due to potential security implications.

CHEATSHEET FORMAT

navi uses a simple, human-readable plaintext format for its cheatsheets. Each entry typically starts with a comment line prefixed with '#', followed by a description line prefixed with '%', and then the command itself. Parameters within commands can be marked with '<param>', which navi prompts the user to fill interactively.

SHELL INTEGRATION

For the most fluid workflow, navi benefits from shell integration. This involves adding specific functions to your shell's configuration file (e.g., ~/.bashrc, ~/.zshrc). These functions allow navi to capture the chosen command from its interactive interface and execute it directly in your current terminal session, rather than just printing it.

HISTORY

navi emerged as a modern solution to the common problem of remembering complex command-line syntax. Written in Rust, it leverages the language's performance and safety features. Its development was driven by the desire for an interactive, flexible cheatsheet tool that goes beyond simple shell aliases or basic text files. Since its inception, it has seen active development on platforms like GitHub, accumulating a strong user base due to its intuitive interface, extensibility, and integration capabilities with popular fuzzy finders, making it a prominent tool in the CLI productivity ecosystem.

SEE ALSO

fzf(1), skim(1), tldr(1), man(1), apropos(1)

Copied to clipboard