Up Next Previous

Spelling correction (+)

The shell can sometimes correct the spelling of filenames, commands and variable names as well as completing and listing them.

Individual words can be spelling-corrected with the spell-word editor command (usually bound to M-s and M-S) and the entire input buffer with spell-line (usually bound to M-$). The correct shell variable can be set to `cmd' to correct the command name or `all' to correct the entire line each time return is typed, and autocorrect can be set to correct the word to be completed before each completion attempt.

When spelling correction is invoked in any of these ways and the shell thinks that any part of the command line is misspelled, it prompts with the corrected line:

> set correct = cmd
> lz /usr/bin
CORRECT>ls /usr/bin (y|n|e|a)?

One can answer `y' or space to execute the corrected line, `e' to leave the uncorrected command in the input buffer, `a' to abort the command as if `^C' had been hit, and anything else to execute the original line unchanged.

Like completion, spelling correction works anywhere in the line, pushing the rest of the line to the right and possibly leaving extra characters to the right of the cursor.

Unlike completion and listing, spelling correction does not extend to completions defined with the complete builtin. Beware: spelling correction is not guaranteed to work the way one intends, and is provided mostly as an experimental feature. Suggestions and improvements are welcome.

Up Next Previous