ELSEIF
Your brief EB
204 stories from 125 feeds 515 clusters Refreshed 9 minutes ago next pull 21:11

TECH Signal 246

Zcomplete learns your command history to correct mistyped shell commands

Zcomplete is a shell utility that suggests the intended command when you mistype, using your history and shell configuration.

WHY IT MATTERS

For engineers who live in the terminal, typo corrections can save time and frustration. Zcomplete works across zsh, bash, and fish, and it learns from your actual usage, so it adapts to your workflow. It also has safety modes to avoid running dangerous commands without confirmation.

Written by elseif from the cluster below · every claim links back to a source

The three things worth knowing

01

Zcomplete supports zsh, bash, and fish with a single binary and one dependency.

02

It learns from your command history and shell aliases, functions, and builtins.

03

It has safety modes and refuses to correct non-interactive shells.

THE READ

What the cluster adds up to.

ORIGINAL ANALYSIS

Zcomplete introduces a new way to handle shell typos: instead of showing 'command not found', it suggests the command you likely meant, based on your own usage history. This is a departure from static alias lists or manual corrections. The tool is designed to be lightweight, with a single binary and minimal dependencies, and it integrates with the three major shells.

The learning mechanism is central. It ranks commands by frequency and recency, and gives extra weight to commands run in the current directory. Matching is done via prefix, initials, subsequence, and typo detection, with usage breaking ties. This means the tool adapts to individual workflows, but it also means it needs a history to learn from, so a fresh install may not be immediately useful.

Adopting Zcomplete costs some setup: you need to install it, add a line to your shell config, and import your history. The installer asks before touching config files, and it verifies checksums. However, the tool has limitations: it only handles one command per line and only the first two words, so complex pipelines or commands with many arguments are out of scope. It also leaves non-interactive shells alone, so scripts and CI are unaffected.

Safety is a key concern. Zcomplete has modes that require confirmation for all corrections, only dangerous ones, or none at all. It maintains a list of dangerous commands and parses flags carefully to avoid false positives. Subcommand corrections only happen after the original command fails, and only if the subcommand is learned from a successful run, preventing the tool from teaching itself incorrect verbs.

The tool stops working when there is no controlling terminal, and it refuses to suggest anything that isn't a valid command. It also cannot correct beyond the first two words, so 'npm run buidl' is out of reach. These constraints keep it safe but limit its scope. Overall, Zcomplete offers a practical solution for a common annoyance, with thoughtful safeguards.

Written by elseif from the cluster below · checked for specifics the sources never contained

THE CLUSTER

Same story, 1 feed.

ORDERED BY FIRST SEEN
github.com via Hacker News Show HN: Zcomplete – Shell Typo Correction Open ↗