# Fix Vim Spell Checking Not Working With Dictionary Files

You enable spell checking in Vim with :set spell, but misspelled words are not highlighted, or Vim reports:

bash
Sorry, no spell checker for "en"

Or the spell checking works but does not recognize domain-specific terminology, flagging perfectly valid technical terms as errors.

Enabling Spell Checking

First, ensure spell checking is properly enabled:

vim
:set spell
set spelllang=en

The spelllang should be a valid language code. Check which spell files are available:

vim
:spellinfo

This shows the location and status of loaded spell files.

Spell File Not Found

If Vim reports it cannot find the spell file, you need to download it:

vim
:set spelllang=en
:set spell

When you first enable spell checking for a language, Vim should prompt to download the spell file. If it does not, download manually:

bash
# For British English
mkdir -p ~/.vim/spell
cd ~/.vim/spell
curl -O https://ftp.nluug.nl/pub/vim/runtime/spell/en.utf-8.spl
curl -O https://ftp.nluug.nl/pub/vim/runtime/spell/en.utf-8.sug

The .spl file contains the word list, and the .sug file contains suggestions for misspelled words. Both are needed for full spell checking functionality.

Verify the files are in the correct location:

bash
ls -la ~/.vim/spell/
# Should show: en.utf-8.spl  en.utf-8.sug

Multiple Languages

For documents with multiple languages:

vim
:set spelllang=en,cjk

This enables English spell checking with CJK (Chinese/Japanese/Korean) character support. For bilingual documents:

vim
:set spelllang=en,de

Both English and German dictionaries are loaded. Words in either language are accepted.

Adding Words to the Dictionary

When Vim flags a word that is actually correct (technical terms, names, acronyms), add it to your personal dictionary:

vim
" Position cursor on the word
zg    " Add to internal word list (spellfile)
zG    " Add to internal word list (not saved to file)

For persistent additions, configure a spellfile:

vim
" In ~/.vimrc
set spellfile=~/.vim/spell/en.utf-8.add

Then zg saves the word to this file. The format is simple -- one word per line:

bash
cat ~/.vim/spell/en.utf-8.add
# Kubernetes
# Netrw
# autocommand

Marking Words as Bad

To flag a word as always misspelled:

vim
zw    " Add to bad word list
zW    " Add to bad word list (not saved to file)

This is useful for catching common typos you repeatedly make.

Spell Checking Navigation Commands

Once spell checking is enabled:

vim
]s    " Jump to next misspelled word
[s    " Jump to previous misspelled word
z=    " Show spelling suggestions for word under cursor
1z=   " Auto-replace with first suggestion

The z= command is the most useful -- it shows a numbered list of suggestions. Press the number to select:

bash
Change "recieve" to:
1. "receive"
2. "relieve"
3. "recline"
4. "recite"
Type number and <Enter> or click with mouse (empty cancels):

Spell Checking Only Comments

For programming, you often want spell checking only in comments, not in code:

vim
:set spell

Vim automatically restricts spell checking to comments and strings for most programming languages. This is controlled by the syntax highlighting rules. Verify:

vim
:syntax on
:set spell

If spell checking highlights code identifiers, the syntax file for your language may not define @Spell regions correctly. Check:

vim
:syntax list

Look for contains=@Spell in comment and string definitions.

Disabling Spell Checking

To turn off spell checking:

vim
:set nospell

For filetype-specific control:

```vim " Disable spell checking for code files autocmd FileType python,javascript,go setlocal nospell

" Enable for text files autocmd FileType markdown,text,tex setlocal spell ```

Custom Spell File for Projects

For project-specific terminology, create a project-level spell file:

vim
" In .vimrc.local or project config
set spellfile+=.vim/spell/en.utf-8.add

Add project-specific terms:

bash
mkdir -p .vim/spell
echo "myproject" >> .vim/spell/en.utf-8.add
echo "apiendpoint" >> .vim/spell/en.utf-8.add

This keeps project jargon out of your personal dictionary while still preventing false positives during editing.