On , I learnt ...
About the typos
source code spell checker
typos
is a source code spell checker written Rust that’s
useful for finding typos in code comments and variable names.
On MacOS you can install from Homebrew:
brew install typos-cli
and run with:
typos
It does tend to yield some false positives but it’s still useful.
Fixing typos in a project
I use it to populate Vim’s quickfix list via:
:cexpr system('typos --format=brief')
then use ,z
to replace the word under cursor with the top spelling suggestion,
which is usually right:
" ~/.vimrc
" Replace word under cursor with top spelling suggestion
nnoremap <leader>z 1z=
Haven’t tried it as a pre-commit hook or CI step yet but will investigate.