One task which I do often during writing git commit message is making sure my commit message don’t have any spelling mistakes. I use Vim a lot and today we will see how Vim’s built-in spell checking features can be used for this task.
triggers Vim spell checking functionality on the currently opened buffer.
- [s move backward to each misspelled word
- ]s move forward to each misspelled word
- z= Once you are on the misspelled word this will show list of suggestions as shown below
The above command will turn off the spell check in Vim.
Adding the following lines to your ~/.vimrc will automatically highlight incorrect spellings during git commit message as shown below
au BufNewFile,BufRead COMMIT_EDITMSG set spell hi clear SpellBad hi SpellBad cterm=underline hi clear SpellCap hi SpellCap cterm=underline hi clear SpellRare hi SpellRare cterm=underline hi clear SpellLocal hi SpellLocal cterm=underline