Wikia

Vim Tips Wiki

Completion using a syntax file

Talk0
1,613pages on
this wiki

Redirected from VimTip765

Tip 498 Printable Monobook Previous Next

created 2003 · complexity intermediate · author Daniel Molina · version 6.0


To complete syntax words, you can use omnicompletion:

setlocal omnifunc=syntaxcomplete#Complete

And then CTRL-X CTRL-O to activate completion.

A more robust solution from :help ft-syntax-omni

if has("autocmd") && exists("+omnifunc")
  autocmd Filetype *
          \	if &omnifunc == "" |
          \		setlocal omnifunc=syntaxcomplete#Complete |
          \	endif
endif

This version will avoid changing omnifunc if it's already set (presumably to something more comprehensive).

See AlsoEdit

CommentsEdit

Around Wikia's network

Random Wiki