blob: b3810e7bb79f78ccf3a75086f91658e225bb21ad [file] [log] [blame]
Travis Swicegood4c3f21a2012-04-30 11:09:46 -05001# This plugin is known to cause issues on OS X with the evaluation of
2# colors. Please read [issue 108] for more information.
3#
4# You can manually turn this on by symlinking it into your
5# plugins/enabled/ directory.
6#
7# [issue 108]: https://github.com/revans/bash-it/issues/108
8
Erich Smith3f8fe612012-05-09 09:27:10 -04009cite about-plugin
10about-plugin 'automatically set your xterm title with host and location info'
11
Antono Vasiljev538980c2011-12-17 11:46:40 +030012set_xterm_title () {
13 local title="$1"
14 echo -ne "\e]0;$title\007"
15}
16
Antono Vasiljevf3c63002012-03-04 22:58:53 +030017
Antono Vasiljev538980c2011-12-17 11:46:40 +030018precmd () {
19 set_xterm_title "${USER}@${HOSTNAME} `dirs -0` $PROMPTCHAR"
20}
21
22preexec () {
23 set_xterm_title "$1 {`dirs -0`} (${USER}@${HOSTNAME})"
24}
25
Antono Vasiljevf3c63002012-03-04 22:58:53 +030026case "$TERM" in
27 xterm*|rxvt*) preexec_install;;
28esac