<!-- Download Links -->
<!-- Add the rest of your HTML here -->
TemplateCompletion macro provides a way to expand short letter sequences
(templates) to larger text blocks while you are typing text. My aim is to make
this process (template completion) as simple and fast as possible.
The idea is to link simple keystroke (backslash for example) with the macro
which reads the word to left of insertion point and replaces it with corresponding
string. If macro does not know the word it inserts character pressed
by user (backslash). This allows user (you) to type character in text.
Installation and testing
You can temporarily toggle on/off template completion. The
ToggleTemplateCompletion command provides this service.
You can change keystroke which invokes completion. The possible choices
are "\" (backslash), "`" (back quote), "|" (bar or "Shift+\"), " " (space).
My first choice was space, but then I changed my mind and now use backslash.
You can also add your own
CompleteTemplate* subroutine to the file
TemplateCompletion.dsm to support any keystroke you want.
You can change the list of the templates. The templates are added by calls to
AddTemplate subroutine. Take a look to "Module initialization"
section. You can freely change set of templates. But keep the templates
distinct. If two or more templates are the same, the first template will be
used in expansion. The
AddTemplate subroutine does not warn about
And you can freely change the code of macro itself.
Additionally I want to bring your attention to "escape sequences" in template
expansion. You have some control over text layout and caret position. The
examples are in TemplateCompletion.dsm file.
When you undo template completion in VC editor, you need to execute
several "undo" commands to remove expanded text (this is also true for
"redo" command). I hope this is minor inconvenience. This behaviour also
takes place when macro does not do template completion at all (when you type
in, for example, backslash in text). If you try to undo your text typing, the first "undo" command deletes text after backslash, second deletes backslash
itself and third deletes text before backslash.
In some configurations VC editor "paste" command breaks after
installation of this macro. In that case go to
page and apply its recommendations to msdev.exe. This helped me to make
"paste" command to work. I hope this will help you also.
Feel free to e-mail me with any comments, suggestions etc.
26 June 2002 - updated download
18 Feb 2003 - updated download