iTerm2 Tools
iTerm2 is a terminal program with some exceptional features written and maintained by George Nachman and contributors.
Features which make it nice:
- Profiles and hot keys to connect to your favorite hosts
- Terminal colorization and background images, badges and animation
- Apparently amazing
tmuxintegration - Tons of other features
iTerm2 provides shell integration directly which has been implemented, largely, with this library.
You can do some pretty cool things like:
- Have a color scheme for your project which updates automatically when you are working in that project
- Display images directly in the console
- Directly copy the last command or its output without selecting it
To integrate, do
! isITerm2 || iTerm2Init
Most commands take the --ignore parameter if you wish to ignore errors when the current terminal is not iTerm2.
isiTerm2
Is the current console iTerm2?
Usage
isiTerm2 [ --help ]
Is the current console iTerm2?
Succeeds when LC_TERMINAL is iTerm2 AND TERM is NOT screen
Arguments
--help- Optional. Flag. Display this help.
Return codes
0- Success1- Environment error2- Argument error
Environment
-
LC_TERMINAL - String. LC_TERMINAL typically identifies the terminal application
-
TERM - String.
iTerm2Init
Add iTerm2 support to console
Usage
iTerm2Init [ --ignore | -i ]
Add iTerm2 support to console
Arguments
--ignore |- -i - Flag. Optional. If the current terminal is not iTerm2, then exit status 0 and do nothing.
Return codes
0- Success1- Environment error2- Argument error
Environment
-
LC_TERMINAL - String. LC_TERMINAL typically identifies the terminal application
-
TERM - String.
iTerm2Badge
Set the badge for the iTerm2 console
Usage
iTerm2Badge [ --ignore | -i ] message ...
Set the badge for the iTerm2 console
Arguments
--ignore |- -i - Flag. Optional. If the current terminal is not iTerm2, then exit status 0 and do nothing.
- message ... - Any message to display as the badge
Return codes
0- Success1- Environment error2- Argument error
Environment
- LC_TERMINAL - String. LC_TERMINAL typically identifies the terminal application
iTerm2Attention
Attract the operator
Usage
iTerm2Attention [ true | false | ! | fireworks ]
Attract the operator
Actions:
- true - start making dock icon bounce
- false - stop making dock icon bounce
- ! - Show fireworks at cursor
- fireworks - Show fireworks at cursor
Arguments
--ignore |- -i - Flag. Optional. If the current terminal is not iTerm2, then exit status 0 and do nothing.
--verbose |- -v - Flag. Optional. Verbose mode. Show what you are doing.
- action. String. Action to attract attention: true, false or !
Return codes
0- Success1- Environment error2- Argument error
iTerm2PromptSupport
Add support for iTerm2 to bashPrompt
Usage
iTerm2PromptSupport [ --help ]
Add support for iTerm2 to bashPrompt If you are wondering what this does - it delimits the prompt, your command, and the output in the console so iTerm2 can be nice and let you select it. It also reports the host, user and current directory back to iTerm2 on every prompt command.
Arguments
--help- Optional. Flag. Display this help.
Return codes
0- Success1- Environment error2- Argument error
Environment
- __ITERM2_HOST
- __ITERM2_HOST_TIME
Requires
catchEnvironment muzzle bashPrompt bashPromptMarkers iTerm2UpdateState __iTerm2_mark __iTerm2_suffix __iTerm2UpdateState
iTerm2Image
Output an image to the console
Usage
iTerm2Image [ --width width ] [ --height height ] [ --preserve-aspect-ratio ] [ --scale ] [ --ignore | -i ]
Output an image to the console
Writes to standard output
No output, however, if in an iTerm2 terminal it will display an image in the console at the cursor position
Arguments
--width width- PositiveInteger. Width in columns to display image.--height height- PositiveInteger. Height in rows to display image.--preserve-aspect-ratio- Flag. Preserve the aspect ratio.--scale- Flag. Do not preserve the aspect ratio, scale the image. --ignore |--i- Flag. Optional. If the current terminal is not iTerm2, then exit status 0 and do nothing.
Return codes
0- Success1- Environment error2- Argument error
iTerm2Download
Download an file from remote to terminal host
Usage
iTerm2Download [ file ] [ --name name ] [ --ignore | -i ]
Download an file from remote to terminal host Argument:
Reads standard input
file
Arguments
file- Optional. File. File to download.--name name- Optional. Target name of the file once downloaded. --ignore |--i- Flag. Optional. If the current terminal is not iTerm2, then exit status 0 and do nothing.
Return codes
0- Success1- Environment error2- Argument error
iTerm2Version
Output the iTerm2 version
Usage
iTerm2Version
Output the iTerm2 version
Arguments
- none
Return codes
0- Success1- Environment error2- Argument error
Requires
stty
iTerm2Notify
Sends a notification message via Mac OS X from iTerm2
Usage
iTerm2Notify message
Sends a notification message via Mac OS X from iTerm2
Arguments
message- String. Required. Text to display.
Return codes
0- Success1- Environment error2- Argument error
iTerm2 Colors
iTerm2ColorNames
Solely the color names (e.g blue), not anything else
Usage
iTerm2ColorNames [ --help ]
Solely the color names (e.g blue), not anything else
Arguments
--help- Optional. Flag. Display this help.
Return codes
0- Success1- Environment error2- Argument error
iTerm2ColorTypes
Colors for various UI elements
Usage
iTerm2ColorTypes
Colors for various UI elements
Arguments
- none
Return codes
0- Success1- Environment error2- Argument error
iTerm2IsColorName
Is it a color name?
Usage
iTerm2IsColorName [ --help ]
Is it a color name?
Arguments
--help- Optional. Flag. Display this help.
Return codes
0- Success1- Environment error2- Argument error
iTerm2IsColorType
This is faster than inArray etc.
Usage
iTerm2IsColorType
This is faster than inArray etc.
Arguments
- none
Return codes
0- Success1- Environment error2- Argument error
iTerm2SetColors
Set terminal colors
Usage
iTerm2SetColors [ --verbose | -v ] [ --skip-errors ] [ --ignore | -i ] colorSetting ...
Set terminal colors
Color names permitted are: - fg bg bold link selbg selfg curbg curfg underline tab - black red green yellow blue magenta cyan white - br_black br_red br_green br_yellow br_blue br_magenta br_cyan br_white
colorFormat is one of:
- RGB - Three hex [0-9A-F] values (hex3)
- RRGGBB - Six hex values (like CSS colors) (hex6)
- cs:hex3 or cs:hex6 - Where cs is one of srgb, rgb, or p3
Color spaces:
- srgb - The default color space
- 1rgb - Apple's device-independent colorspace
- p3 - Apple's large-gamut colorspace
If no arguments are supplied which match a valid color setting values are read one-per-line from stdin.
Reads standard input
colorName=colorFormat. One per line. Only if no arguments passed with colorSetting format.
Arguments
--verbose |- -v - Flag. Optional. Verbose mode. Show what you are doing.
- --skip-errors - Flag. Optional. Skip errors in color settings and continue - if loading a file containing a color scheme will load most of the file and skip any color settings with errors.
--ignore |- -i - Flag. Optional. If the current terminal is not iTerm2, then exit status 0 and do nothing.
- colorSetting ... - String. Required. colorName=colorFormat string
Return codes
0- Success1- Environment error2- Argument error
Aliases for iTerm tools
These aliases are provided by iTerm2.
iTerm2Aliases
Installs iTerm2 aliases which are:
Usage
iTerm2Aliases [ --help ]
Installs iTerm2 aliases which are:
it2check- Check compatibility of these scripts (non-zero exit means non-compatible)imgcat- Take an image file and output it to the consoleimgls- List a directory and show thumbnails (in the console)it2attention- Get attention from the operatorit2getvar- Get a variable valueit2dl- Download a file to the operator system's configured download folderit2ul- Upload a file from the operator system to the remoteit2copy- Copy to clipboard from file or stdinit2setcolor- Set console colors interactivelyit2setkeylabel- Set key labels interactivelyit2universion- Set, push, or pop Unicode version
Internally supported:
imgcat=iTerm2Imageit2attention-iTerm2Attentionit2dl-iTerm2Downloadit2setcolor-iTerm2SetColors
Arguments
--help- Optional. Flag. Display this help.
Return codes
0- Success1- Environment error2- Argument error