From: Simon Ruderich Date: Tue, 14 Feb 2012 01:35:50 +0000 (+0100) Subject: zsh/rc: Add support for tmux to window_preexec(). X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=7b1ae14f7cb522ffc143465dd02afd2bfdad1d62;p=config%2Fdotfiles.git zsh/rc: Add support for tmux to window_preexec(). --- diff --git a/zsh/rc b/zsh/rc index fbf9aea..4f5d100 100644 --- a/zsh/rc +++ b/zsh/rc @@ -328,21 +328,21 @@ $green%B%n%b$default@$green%B%m%b$default %(1j.$yellow%j$default.)%# \ add-zsh-hook precmd prompt_precmd -# When screen, xterm or rxvt is used set the name of the window to the +# When screen, tmux, xterm or rxvt is used set the name of the window to the # currently running program. # # When a program is started preexec() sets the window's name to it; when it # stops precmd() resets the window's name to 'zsh'. 'fg' is supported and sets # the window's name to the resumed job. # -# It works with screen, xterm and rxvt. +# It works with screen, tmux, xterm and rxvt. # # If a command is run with sudo or if the shell is running as root then a ! is # added at the beginning of the command to make this clear. If a command is # running on a different computer with ssh a @ is added at the beginning. If -# screen is running on the remote machine instead of @screen @:hostname -# (hostname replaced by the machine's hostname) is displayed. This only works -# if the .zshrc on the server also uses this command. +# screen/tmux is running on the remote machine instead of @screen @:hostname +# (or @tmux ..; hostname replaced by the machine's hostname) is displayed. +# This only works if the .zshrc on the server also uses this command. # # screen* is necessary as `screen` uses screen.linux for example for a linux # console. @@ -411,10 +411,10 @@ if [[ $TERM == screen* || $TERM == xterm* || $TERM == rxvt* ]]; then # If screen is running in SSH then display "@:hostname" as title # in the term/outer screen. - if [[ $program_name == @screen ]]; then + if [[ $program_name == @screen || $program_name == @tmux ]]; then program_name="@:${HOST//.*/}" # Use "@:!hostname" for root screens. - elif [[ $program_name == @!screen ]]; then + elif [[ $program_name == @!screen || $program_name == @!tmux ]]; then program_name="@:!${HOST//.*/}" fi fi @@ -451,9 +451,9 @@ if [[ $TERM == screen* || $TERM == xterm* || $TERM == rxvt* ]]; then window_reset= } - # Sets the window title. Works with screen, xterm and rxvt. (V) escapes - # all non-printable characters. Thanks to Mikachu in #zsh on Freenode - # (2010-08-07 17:09 CEST). + # Sets the window title. Works with screen, tmux (which uses screen as + # TERM), xterm and rxvt. (V) escapes all non-printable characters. Thanks + # to Mikachu in #zsh on Freenode (2010-08-07 17:09 CEST). if [[ $TERM == screen* ]]; then window_title() { print -n "\ek${(V)1}\e\\"