advanced autocomplete

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

advanced autocomplete

Mojca Miklavec


ConTeXt, a TeX macro package, has a huge, however finite number of
commands. I would like to get some hints about the possibilities of

Consider the following minimal example:

We have two commands \setupcolor and \setuplayout, an example usage
would be:

\setupcolor[My Color][red=.5,blue=.1,green=0]

Is it feasible to write an auto-completion tool to:

1. autocomplete the commands like \setupcolor and \setuplayout
2. autocomplete options within a single command, for example to choose
only between width, style and grid when inside the first square brackets
of \setuplayout
3. to offer only yes/no after the grid= command in \setuplayout and only
regular/bold/italic/bolditalic after width= in \setuplayout?

There is a list of available commands (some 1000, some of them have
around 20 options), so once I would know a general scheme to support
autocompletion for one command, preparing support for the rest would be

I know that syntax highlighting is pretty advanced in vim and that
writing a syntax-highlighter is doable for something like that (however
I'm not sure if vim would be fast enough to process so many regexps at
I know that some people wrote Java plugins for example to support some
Java-specific behaviour (probably auto-complete as well). But how
advanced are the native auto-completion capabilities of vim? Does
support for the described auto-completion mean writing a complex plugin
or is there a simpler way?

Thank you very much,
        Mojca Miklavec
Reply | Threaded
Open this post in threaded view

Re: advanced autocomplete

> \setupcolor[My Color][red=.5,blue=.1,green=0]
> \setuplayout
>     [width=3cm,
>      style=bold,
>      grid=yes]

tSkeleton[1] can do this to some extent if you provide a map file.
Context-sensitive expansion is currently only implemented for
deplate/viki[2] mode though.

This doesn't use vim's "native" auto completion. But maybe this is of
some use for you.

- thomas