Typo handler for Mercurial commands
Corrects simple typing errors in commands using Damerau-Levenshtein distance.
hg doff or
hg banrch? This fixes that.
Some examples of how it helps:
$ hg dfif Correcting 'dfif' to 'diff' $ hg brnch Correcting 'brnch' to 'branch'
Installing hg-canttype is simple:
$ pip install hgcanttype
Setup is easy too, just add hgcanttype to your hgrc:
You can configure the distance to consider a command “close enough” like so:
[canttype] distance = 5
The default is 1. Take note that setting the distance too high is a bad idea:
$ hg dfif Correcting 'dfif' to 'help'
You can also configure the plugin to provide suggestions rather than automatically correcting the command, just like git:
$ hg dfif hg: unknown command 'dfif' Did you mean this? diff
This is easy to configure:
[canttype] suggest = true
Note that it will automatically do this if it finds more than one command, even if you have suggestions turned off:
$ hg cu hg: unknown command 'cu' Did you mean this? ci cp co
As this is a derived work of the Mercurial project, the license is GPLv2+ as per the Mercurial License page.