From 00ea716415c5fafec5fe824af7ff62b3321d7a75 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 21 Apr 2014 15:09:34 +0200 Subject: Improve integration with screen Set the window name to the running command. --- .zshrc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.zshrc b/.zshrc index 1e79c12..638210a 100644 --- a/.zshrc +++ b/.zshrc @@ -63,15 +63,24 @@ PROMPT='${vcs_info_msg_0_} # Set terminal name to current running application case $TERM in - rxvt*) - precmd () { print -Pn "\e]0;%~\a" } - preexec () { print -Pn "\e]0;$1\a" } - ;; eterm-color*) # Make {{ansi,multi}-,}term change Emacs' `default-directory' # and keep track of the current user and host. precmd () { print -P "\eAnSiTu %n\n\eAnSiTc %~" } ;; + rxvt*) + precmd () { print -Pn "\e]0;%~\a" } + preexec () { print -Pn "\e]0;$1\a" } + ;; + screen) + # Make screen show the current running command as window title + # or the shell if no command is running. The running command + # is presented as the first sequence of characters without a + # space on the given command line, possibly prefixed with + # `sudo '. + preexec () { print -Pn "\ek$(basename $1 | sed -e 's/^\(\(sudo \)\?[^ ]\+\).*/\1/')\e\\" } + precmd () { print -Pn "\ek$(basename $SHELL)\e\\" } + ;; esac export XDG_CACHE_HOME="$HOME/.cache" -- cgit v1.2.3-54-g00ecf