Mercurial Tab Completion: From Silence to Speed

Your fingers pause on the keyboard. You type hg and nothing happens. No suggestions. No magic. Just silence.

Mercurial tab completion changes that silence into speed. Once you enable it, the command line starts working with you instead of against you. You press Tab, and it fills in commands, branches, tags, and file names in real time. You move faster, make fewer mistakes, and spend less time hunting through hg help or scrolling your history.

Mercurial already has built‑in support for tab completion in Bash, Zsh, and other shells. The setup is quick:

  1. Locate the contrib/bash_completion file in your Mercurial installation.
  2. Source it in your shell profile, for example:
source /path/to/mercurial/contrib/bash_completion
  1. Restart your shell or run source ~/.bashrc (or .zshrc) to apply.

Now try it. Type hg com and press Tab. It completes to hg commit. Add a space and press Tab again, and it lists modified files. It works with commands like hg update, hg merge, hg log, and any aliases you’ve defined. In Zsh, you can make it even smarter with fuzzy matching and color. In Bash, you can add case‑insensitive completion.

If you work with multiple repositories or large histories, tab completion becomes more than convenience. It’s a precision tool. You avoid typos in branch names. You reduce cognitive load remembering complex file paths. You cut command time down to seconds. In big CI/CD pipelines, those seconds stack into something noticeable.

For teams, enabling Mercurial tab completion across developer machines keeps everyone aligned. Fewer broken scripts. Fewer branch naming errors. Less noise in code reviews.

Setup takes minutes. The speedup lasts for years.

If you want to see automation like this wired into a bigger workflow—branch creation, pull requests, deploys—without touching a config file, try hoop.dev. You can watch it live in minutes, and the boost feels instant. This is what the command line should have always been.