Navigation: TextEd > Introduction > Tutorials and misc functions >

Create a new Abbreviation

 

 

 

Abbreviations are short simple phrases, linked to a highlighter, that can be expanded to a code block containing TAB stops. Abbreviations are added to the "Text Clips" panel and have its own tree node. Each sub tree node is a highlighter node (or folder) and abbreviation clips are added to the highlighter node. Which means you can use the same abbreviation over and over for different highlighters. E.g. an abbreviation named "for" inside the "C++" and "PHP" nodes.
 

Abbreviations (and text clips) can handle both tab positions and multiple selections. E.g. if you insert the same tab position variable several times - they will all be highlighted and you can edit all positions at the same time.
 

Use add/edit item from the text clips panel to add or edit an abbreviation.
 


   

Ex: This is the clip added to the PHP branch with the name "for".

   

----------------------------------------------------------------

    [[#1]] = $tab x

    [[#2]] = $tab 0

    [[#3]] = $tab

    [[#4]] = $tab

----------------------------------------------------------------

   

    for ($[[#1]] = [[#2]]; $[[#1]] <= [[#3]]; $[[#1]]++) {

          [[#4]]

    }


 

How to use added abbreviations


To use the abbreviation "for", simply open a PHP file and type "for". Press SHIFT+ENTER, TAB or SPACE. Use ALT+ENTER to display the expanded code in a hint window first, to preview the result.

   

The clip is expanded and the first tab(s) are selected. In this case [[#1]], which is replaced by "x". All three instances of "x" are selected and can be edited at the same time.

   

    for ($x = [[#2]]; $x <= [[#3]]; $x++) {

          [[#4]]

    }

   

To keep the x as variable just press TAB. Otherwise type the new variable name.

Press TAB to select [[#2]], which is replaced by "0". Tab positions [[#3]] and [[#4]] are replaced by "" and are only used to move the text cursor when you hit TAB.
 

You can hit ESC at any time to cancel the tab stop mode and start edit the rest of the code manually.
 

Expanding abbreviations using TAB or SPACE is not always possible in a source code. E.g. inside comments, strings or HTML/XML tags. This is so you can use these keys for editing without any accidental abbreviation expansion. If you really need to expand an abbreviation inside a comment you can still use the keyboard shortcut SHIFT+ENTER.


 

Variable commands

You can use the same variable commands as in ordinary text clips. E.g. insert the current date in the expanded clip.


 

 



 

 

 

 

Copyright © 2022 Rickard Johansson