ChimeraX docs icon

Command: alias

Usage:
alias  namewordlist ]

Usage:
alias  listinternal ]

Usage:
alias  deletename | all )

The alias command defines a new command name as the specified wordlist, which could be a composite of other commands. That is, wordlist may contain multiple commands separated by semicolons. Subsequent uses of name as a command (at the beginning of a line, following a semicolon, or as a command argument of perframe) will be replaced with wordlist. Aliases are saved in sessions. It may be useful to create aliases automatically at ChimeraX startup by including alias commands in the Startup preferences. For assigning a name to a selection or target specification, see the name command instead. See also: buttonpanel, functionkey, custom presets

Within wordlist, $1, $2, $3 ... may be used to indicate the first, second, third ... arguments of name. In addition, $$ indicates $ itself, and $* indicates the rest of the line, which allows for variable numbers of arguments. For example, ribbon is aliased to cartoon $*, allowing any of the following to work:

ribbon
ribbon #1/A
ribbon #4 suppress false
A string that contains spaces can be designated as a single argument by enclosing it in single or double quotation marks. The quotation marks will be omitted when the alias is expanded. For example,
alias ribcolor color $1 $2 targ c
ribcolor '/a & helix' 'dodger blue'
is equivalent to
color /a & helix dodger blue targ c

An example of multiple commands, in this case without arguments:

alias reset view orient; view initial

The definition of a pre-existing alias can be shown with alias name.

The command alias list lists the current user-defined aliases in the Log, whereas alias list internal lists the built-in aliases.

The command alias delete can be used to “forget” a specific alias or all aliases.


UCSF Resource for Biocomputing, Visualization, and Informatics / February 2020