Right now if I hit ctrl + n it will complete words that are in the current document. I've also found a way to define a dictionary. I'm just unsure how to get vim to complete based on keywords in a language.

I don't mind building my own dictionaries. Is there a way to define a dictionary for each language?


Vim comes with the syntaxcomplete plugin that extracts the language keywords from the syntax plugins used for syntax highlighting. You can install this as the omni completion function via

setlocal omnifunc=syntaxcomplete#Complete

and then trigger via <C-x><C-o>. See :help ft-syntax-omni for details and how to configure it.


If you rather want to maintain the word list yourself, define a Dictionary file via

:set dictionary=/path/to/dict-file

and trigger via <C-x><C-k>.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.