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:
- Locate the
contrib/bash_completionfile in your Mercurial installation. - Source it in your shell profile, for example:
source /path/to/mercurial/contrib/bash_completion
- 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.