The cursor blinks. You type hg and stop. Why finish the command when Mercurial tab completion can do it in one keystroke?
Mercurial tab completion is a shell integration that lets you auto-complete commands, options, branch names, and file paths. It saves time, reduces typos, and makes complex workflows faster. Once installed, you no longer need to remember every flag or branch name. You press Tab, and the shell fills in the rest.
Most Mercurial setups include tab completion scripts for Bash, Zsh, and Fish. These scripts parse the repository’s context in real time, offering only valid completions based on your current state. For example, in Bash, you can enable Mercurial tab completion by sourcing the mercurial-completion script, often packaged with your OS or available in the official Mercurial repository:
source /usr/share/mercurial/bash_completion
In Zsh, completion integrates seamlessly with your .zshrc using:
autoload -Uz compinit && compinit
Then link to or source the Mercurial completion file. Fish users can use hg completions via function definitions or plugin managers.