Skip to content

UltraEdit Tab Expansion Macros

January 25, 2007

It is a shame that for the moment UltraEdit and UEStudio do not support TAB keyword expansion. After testing it for a while i found the editor to be really good but lacking, in my view, this extremely important feature.

After messing around with the configuration for a while, trying the auto completes, templates, etc, i found none of these features really didn’t do what i wanted. Expand a keyword as soon as one presses the TAB key, leaving the cursor at the proper position for continuing your edit as fast as possible.

so i started playing around with the macros and after much head banging and trial and error
(mostly error) I wrote the set of macros attached to this post that do what I wanted.
I don’t know the limitations on the number of commands per macro, or if this is the best way to achieve the proposed goal, so if you find a way to improve this please be my guest, just let everybody else know about it.

The perfect solution would be for UltraEdit to support this feature, by reading a text file with keywords and their expansions or something like that, but for the moment you can use this workaround.

The macros assume that you have UltraEdit configured to automatically insert the closing Prentiss, or curly braces (Advanced->Configuration->IDE->InteliTips->Miscellaneous)
And Smart Placement of “}” when placed automatically is also checked.

After loading the macros assign the TabExpand macro to the TAB key. If you do this remember that the autocomplete feature will be disabled. You can always use a different key thought.

The structure of the macros is simple:

create a new macro for each tab keyword expansion you want. call it TE_keyword

write the macro as follows

Find MatchWord Select “your_keyword
Replace SelectText “your_expanded_text
PlayMacro 9 “TE_Left”

replace the your_keyword with the keyword you like and do the same with your_expanded_text, which is the text that should be placed after the keyword is “expanded”.

After the IfFound command you can place more macro instruction, either to place the cursor properlly or insert more text.

to activate the newly created macro modify the TabExpand macro and add the following code to it:

PlayMacro 1 “TE_keyword”

The IFSel is a hack in order for the macro to exit if there was any replacement done. meaning the keyword was expanded in the previous call to PlayMacro. This is not very beautiful but works. If you know of a better way to do this let me know…

Please take a look at all the predefined macros in the file for more details on how to use the TabExpand “system”

Download the macro file from here.

  1. Ramsee permalink

    Dear sir !
    I want one replacing macro for some useful project pls send the ultraedit macro coding
    for ex,
    xref bibr rid=””>ramsee, 1990;
    xref bibr rid=””>ramsee, 2000;
    **this is 1st doc.**
    ref id=”ref_1″>ramsee, 2000;
    ref id=”ref_2″>ramsee, 1990;
    **this is 2nd doc.**

    how it will be replace ref id pls give the suggestion.

  2. I believe what you published made a lot of sense.
    But, what about this? what if you were to write a awesome headline?
    I ain’t suggesting your content is not solid., but what if you added something that makes people desire more? I mean UltraEdit Tab Expansion Macros | BigDiver is a little vanilla. You might peek at Yahoo’s front page and see how
    they create article headlines to grab people to open the links.
    You might try adding a video or a related pic or two to grab people interested about everything’ve got to say. Just my opinion, it would bring your posts a little livelier.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: