vimtricks.wiki Concise Vim tricks, one at a time.

How do I include dictionary and spelling words in Vim's insert-mode autocomplete?

Answer

:set complete+=kspell

Explanation

Vim's built-in completion (<C-n> / <C-p>) sources matches from buffers, included files, and tags by default. By adding kspell to the complete option and enabling spell checking, you get the entire spelling dictionary as a completion source — perfect for writing prose, documentation, or commit messages.

How it works

  • :set spell — enables spell checking (required for kspell to work)
  • :set complete+=kspell — adds the spell dictionary to the completion scan list
  • Now <C-n> and <C-p> in insert mode will suggest correctly-spelled words alongside buffer matches

The kspell source is only active when spell is on. This means you can toggle it per buffer — enable spell and kspell completion for Markdown files while keeping code buffers unaffected.

Example

With :set spell complete+=kspell, typing acco then pressing <C-n>:

acco█
  accommodate
  accomplish
  accomplished
  according
  account

Tips

  • Combine with an autocommand for prose filetypes: autocmd FileType markdown,text setlocal spell complete+=kspell
  • Use :set spelllang=en_us to choose your dictionary language
  • The kspell source integrates seamlessly with <C-x><C-n> keyword completion and popup menu navigation

Next

How do I use PCRE-style regex in Vim without escaping every special character?