[OS X TeX] BBAutocomplete script for TeXShop (Working Version)
Ramon M. Figueroa-Centeno
ramonf at hawaii.edu
Wed Mar 4 23:57:53 CET 2009
Aloha Herb,
Maarten is right. It complements the built-in Completion (it really is not
Auto Completion).
It works best if one sets a key combination for the macro and in the
BBAutoComplete preferences one adds "*" as an additional word character
(that way starred commands, e.g., align*, can also be completed).
For example, (assume that the key combination is Command-Option-B) and I
type "beg" followed by Command-Option-B, then I get "begin". Hit
Command-Option-B, again and I get "began". Keep doing this and you will
cycle through "begin", "began", "begawan", "beget", "begets", "begetter",
"begetters", "begetting", "beggar", ..., and eventually back to "begin".
It first looks for matches in the text above the point you are in, then
below, then in the list of terms that I added to the script, and then in the
system dictionary. The list, called "LaTeX_Keywords" in the script, can be
modified (I just added all the keywords in my Completion.plist) and
BBAutoComplete can be told not to look in the system dictionary in its
preferences, as TeXShop (and all other Cocoa applications) have this
capability already; see below).
Another example, say you have "\label{herb1}" in your document and later you
want to insert "\ref{herb1}". To do this type "\re", then Control-Esc, then
"her" and then Command-Option-B (until you get "herb1").
So with this macro we have now four kinds of completion in TeXShop:
1. Command completion invoked via Control-Esc (I use your modified TeXShop,
by the way).
2. Command completion invoked via Option-Esc (we get a scrollable list from
the system dictionary; and Bibdesk). This might be preferable to the similar
functionality that BBAutoComplete gives, as a list is provided.
3. Auto Completion, type "^" and get "^{}" with the cursor between the
parentheses.
4. What this script adds, i.e., completion based on the contents of the
document.
It be nice to meld 1, 2 and 4 in some sensible way.
Sincerely,
Ramón
on 3/4/09 6:15 AM, Maarten Sneep at maarten.sneep at xs4all.nl wrote:
> Herbert Schulz schreef:
>
>> I've never used BBAutoComplete and am curious about how it this
>> different than using Command Completion within TeXShop.
>
> It is not just commands, it searches for all words that could be used as a
> possible completion you used in either the frontmost document, or all open
> documents in TeXShop, BBEdit, or any other supported editor.
>
> So it is not a fixed dictionary, or a limited subset of commands.
>
> But then, I haven't used TeXShop in a long time, and command-completion
> may do more than the name implies.
>
> Maarten
>
>
--
Ramón M. Figueroa-Centeno, Ph.D.
Associate Professor
Mathematics Department
University of Hawaii at Hilo
College Hall 4-A
200 W. Kawili St.
Hilo, HI 96720-4091
(808) 974-7387 (office)
(808) 933-3473 (fax)
http://www2.hawaii.edu/~ramonf/
PGP/GnuPG Public Key at http://www2.hawaii.edu/~ramonf/ramonf.gpgkey
More information about the macostex-archives
mailing list