Set terminal emulatior title
authorAntono Vasiljev <self@antono.info>
Sat, 17 Dec 2011 08:46:40 +0000 (11:46 +0300)
committerAntono Vasiljev <self@antono.info>
Sat, 17 Dec 2011 08:46:55 +0000 (11:46 +0300)
plugins/available/xterm.plugins.bash [new file with mode: 0644]

diff --git a/plugins/available/xterm.plugins.bash b/plugins/available/xterm.plugins.bash
new file mode 100644 (file)
index 0000000..94d4c33
--- /dev/null
@@ -0,0 +1,14 @@
+set_xterm_title () {
+    local title="$1"
+    echo -ne "\e]0;$title\007"
+}
+
+precmd () {
+    set_xterm_title "${USER}@${HOSTNAME} `dirs -0` $PROMPTCHAR"
+}
+
+preexec () {
+    set_xterm_title "$1 {`dirs -0`} (${USER}@${HOSTNAME})"
+}
+
+preexec_install