Remembering to Check Spelling

I am a vim user, and I like to use it whenever I am editing text. I mostly use it for writing code, so I am not that worried about making spelling mistakes.

And, because I frequently write in Word for work, I get used to having automatically on spell checking. This has meant that I think that my spelling is being checked, even while it isn't.

So, today I decided to switch on spell checking in vim. It turns out that I already had something in my .vimrc to switch on spelling. I was just never using it. Even though I just had to type ,s.

function! SpellCheckToggle()
    if (&spell == 1)
        set nospell
    else
        set spell spelllang=en_us
    endif
    echom 'Spell Checking ' &spell ? "ON" : "OFF" 
endfunc
nnoremap <silent> <leader>s :call SpellCheckToggle()<CR>

So, clearly what I need to do is automatically turn on spellcheck for all markdown files. I found this post on setting it up.

autocmd BufRead,BufNewFile *.md setlocal spell
autocmd FileType gitcommit setlocal spell

Once it automatically turns on for your markdown files, you will start to see the misspelled words highlighted.

The commands to go to highlighted words automatically are ]s (to jump to the next highlighted word) and [s to jump to the previous highlighted word. The one I always forget is: z= to make suggestions for the correct spelling.

Notes

links

social