# [texworks] SCRIPTING: Autocompletion based on the current file.

Henrik Skov Midtiby henrikmidtiby at gmail.com
Thu Dec 30 11:07:02 CET 2010

An embedded and charset-unspecified text was scrubbed...
Name: warning1.txt
URL: <http://tug.org/pipermail/texworks/attachments/20101230/4aecfc8e/attachment.txt>
-------------- next part --------------
A new version of the script is available. It is now context aware with
respect to the commands \label \ref and \pageref.
If you try to complete a parameter to a \label it will only search for
matches which itself are parameters to the commands \ref and \pageref.

Best regards,
Henrik Skov Midtiby

On 27 December 2010 08:59, Henrik Skov Midtiby <henrikmidtiby at gmail.com> wrote:
> Hi
>
> I have just started messing around with the texworks scripting
> capabilities, and a lot of possibilities begin to appear. I hope to
> find time to explore it further ;-)
>
> My first real script is a kind of autocompleter, inspired by the one
> found in vim. It looks at the word you were typing when the script was
> activated and locates matching words in the current file. The script
> is uploaded to the script issue [1].
>
> Some ideas for where the script can be improved:
> * look for matching words in related files (files opened by texworks,
> bibtex file, ...)
> * context aware: only locate labels when autocompleting a parameter to
> a \ref command
>
> My question is then how to determine the other tex files witch are
> opened by texworks when the script is invoked?
>
> Best regards,
> Henrik Skkov Midtiby
>