Arbortext Command Language > Commands
  
Commands
alias
aliasnewcmd { cmd1 | { cmd1; [ cmd2; …]} | {}}
This command maps cmd1 and any successive commands to the name newcmd. You can then execute the commands by typing newcmd at the Arbortext Editor command line, or by mapping the alias to a specific key on the keyboard.
To alias a command that has parameters (such as substitute), you must include the parameters when specifying the alias or supply a symbolic parameter (such as $1), the value of which is to be supplied when the alias is used.
If you alias newcmd to more than one command, the commands to which it is aliased must be enclosed in curly braces. To define the alias name so that you can make a forward reference to it, use:
alias newcmd {}
The commands in an alias must be separated by a semicolon (;) if they appear on the same line. If each command resides on a separate line, a semicolon is legal but not mandatory. For example, you might define this alias:
alias setit { insert_tag figure-block; \
insert_string -sgml "<graphic>"}
To use the alias shown in the example above, type setit at the command line. Typing setit sequentially runs the commands defined in the “setit” alias.
* 
The curly brace ({) that opens the alias must always be on the same line as the alias command.
Defining an alias in a file (for example, your user startup file) and then using the source command with this file does not actually run the alias. At this point, the system just defines the alias for Arbortext Editor. To actually use the alias shown in the previous example, you must type setit at the Arbortext Editor command line.
To easily access an alias, you can map it to a key on the keyboard. For example, you would enter the following to map the F3 key to the setit alias:
map F3 setit
Following are some additional examples of the alias command:
alias divide split
ali home caret top,first
ali replace sub $*
ali repl replace $*
ali mark_char {mark begin; caret 0,+1; mark;}
ali transpose {
caret 0,-2;
mark_char;
dm;
caret 0,+1;
paste;
}
# The following commands define individual aliases
# to define each of the three varieties of dashes
alias insert_hyphen {
insert_string -sgml "-X";
delete_character;
}
alias insert_ndash {insert_string -sgml "&ndash;"}
alias insert_mdash {insert_string -sgml "&mdash;"}
Related Topics
unalias command
execute command
map command
readvar command
show variables command
Symbolic parameters
Command variables