HunspellColorize
Wrapper around 'less' to colorize spelling mistakes using Hunspell
A small command line tool that colorizes misspelled words as text scrolls through a pager, handy for catching typos in git commit messages.
HunspellColorize is a small command-line tool by Linus Torvalds that highlights spelling mistakes in text as it is displayed in a terminal. It is intended to be used as a pager, meaning it sits between a program that produces text output and the terminal where you read it, coloring any words that appear to be misspelled.
The typical use case described in the README is pairing it with git so that commit messages and diffs are spell-checked as they scroll by. You set two environment variables to point your terminal pager and git's pager at this tool, and misspelled words will appear highlighted.
The author describes this as a stop-gap solution built because he could not find an existing tool that did this simple job. The longer-term plan is to add spell-checking directly to uemacs, a text editor he maintains, but this smaller project let him test the underlying spell-checking library first. The tool uses Hunspell, a spell-checking library, and only handles plain US ASCII text. It does not understand context, so it will flag words inside file paths, URLs, and code the same as it would flag words in prose.
Where it fits
- Set it as your GIT_PAGER so misspelled words in commit messages and diffs stand out visually.
- Pipe any plain text through it to catch typos before publishing.
- Use it as a lightweight way to try Hunspell before building spell check into a larger tool.