iTerm2 is a terminal emulator for Mac OS X that does amazing things.
Triggers
 
Back to top
A trigger is an action that is performed when text matching some regular expression is received in a terminal session.

What can Triggers Do?

Various actions may be assigned to triggers. These include:
  • Bounce Dock Icon: Makes the dock icon bounce until the iTerm2 window becomes key.
  • Ring Bell: Plays the standard system bell sound once.
  • Run Command: Runs a user-defined command.
  • Run Coprocess: Runs a Coprocess.
  • Send Growl Alert: If Growl is enabled, a Growl alert is sent.
  • Send Text: Sends user-defined text back to the terminal as though the user had typed it.
  • Show Alert: Shows an alert box with user-defined text.

What is a Parameter?

Various actions (Run Command, Run Coprocess, Send Growl Alert, Send Text, and Show Alert) require additional information. This is specified in the "Parameters" field. Some special values are allowed here:

ValueMeaning
\0 The entire value matched by the regular expression.
\1, \2, ..., \9 The nth value captured by the regular expression.
\a A BEL character (^G).
\b A backspace character ^H.
\e An ESC character (ascii 27).
\n A newline character.
\r A linefeed character.
\t A tab character.
\xNN A hex value NN (for example: \x1b sends ascii code 27, an ESC).

Example

The iTerm2-zmodem project demonstrates hooking up iTerm2 to zmodem upload and download.

Technical Details

Regular expressions conform to the ICU regular expressions rules. All input, including escape codes, is considered when matching against a regex. Only one line at a time is matched. Matching is performed when a newline or cursor-moving escape code is processed. Lines longer than 1024 characters are truncated at the 1024th character for performance reasons.
iTerm2 by George Nachman. Website by Matthew Freeman, George Nachman, and James A. Rosen.