aboutsummaryrefslogtreecommitdiff
path: root/templates/.zsh/window.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'templates/.zsh/window.zsh')
-rw-r--r--templates/.zsh/window.zsh19
1 files changed, 19 insertions, 0 deletions
diff --git a/templates/.zsh/window.zsh b/templates/.zsh/window.zsh
new file mode 100644
index 0000000..805cb92
--- /dev/null
+++ b/templates/.zsh/window.zsh
@@ -0,0 +1,19 @@
+# From http://dotfiles.org/~_why/.zshrc
+# Sets the window title nicely no matter where you are
+function title() {
+ # escape '%' chars in $1, make nonprintables visible
+ a=${(V)1//\%/\%\%}
+
+ # Truncate command, and join lines.
+ a=$(print -Pn "%40>...>$a" | tr -d "\n")
+
+ case $TERM in
+ screen)
+ print -Pn "\ek$a:$3\e\\" # screen title (in ^A")
+ ;;
+ xterm*|rxvt)
+ print -Pn "\e]2;$2\a" # plain xterm title ($3 for pwd)
+ ;;
+ esac
+}
+