Abbreviations are invoked by typing a couple of letters and then
which takes the word before the caret as the abbreviation name. If that
particular abbreviation was not yet set, a dialog will pop up, and you
can enter the text to insert before and after the caret. After the
abbreviation is created, it can be viewed or edited from the
pane of the
dialog box; see the section called “The Abbreviations Pane”.
Using abbreviations reduces the time spent typing long but
commonly used strings. For example, in Java mode, the abbreviation
“sout” is defined to expand to
“System.out.println()”, so to insert
“System.out.println()” in a Java buffer, you only need to
type “sout” followed by
abbreviation can either be global, in which case it can be used in all
edit modes, or specific to a single mode.
The Java, VHDL. XML and XSL edit modes include some pre-defined abbreviations you might find useful. Other modes do not have any abbreviations defined by default.
Automatic abbreviation expansion can be enabled in thepane of the > dialog box. If enabled, pressing the space bar after entering an abbreviation will automatically expand it.
If automatic expansion is enabled, a space can be inserted without
expanding the word before the caret by pressing
Positional parameters are an advanced feature that make abbreviations much more useful. The best way to describe them is with an example.
Java mode defines an abbreviation “F” that is set to expand to the following:
for(int $1 = 0; $1 < $2; $1++)
F#j#array.length# will insert the
following text into the buffer:
for(int j = 0; j < array.length; j++)
Expansions can contain up to nine positional parameters. Note that a trailing hash character (“#”) must be entered when expanding an abbreviation with parameters.
If you do not specify the correct number of positional parameters when expanding an abbreviation, any missing parameters will be blank in the expansion, and extra parameters will be ignored. A status bar message will be shown stating the required number of parameters.