Завершение Vim на основе языка

300
Ravenous

Прямо сейчас, если я нажму Ctrl + N, он завершит слова, которые находятся в текущем документе. Я также нашел способ определить словарь. Я просто не уверен, как получить Vim для завершения на основе ключевых слов на языке.

Я не против построить свои собственные словари. Есть ли способ определить словарь для каждого языка?

1
См. Этот ответ в StackOverflow: http://stackoverflow.com/questions/21634114/vim-load-buffer-depending-on-file-type/21634935#21634935. benjifisher 10 лет назад 0

1 ответ на вопрос

1
Ingo Karkat

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.

Alternative

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>.