Boost Your Workflow with Mercurial Tab Completion

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.

Tab completion works for more than commands. It lists available bookmarks, tags, and branches from the current repo. It autocompletes file paths in changesets. It even helps discover commands you forgot existed. This reduces the mental overhead when switching between projects or maintaining large codebases.

You can extend Mercurial tab completion by editing the completion scripts. Advanced users add custom aliases and workflow-specific commands, and tab completion will recognize them. This is especially powerful if your team has a set of repeatable tasks that should be shortened to simple triggers.

If tab completion feels slow or incomplete, ensure your scripts are updated to match your Mercurial version. Many performance gains come from newer completion logic that caches repo data intelligently.

Use Mercurial tab completion to keep your development cycle lean. Stop wasting keystrokes. Type less, commit more.

Want to see lightning-fast tab completion without touching config files? Open an environment in hoop.dev and watch it work live in minutes.