docs:tips_n_tricks:screen.html
This is an old revision of the document!
Table of Contents
screen
show current directory or command in window name when using zsh
put this in your .zshrc
case "$STY" in "") ;; "$PPID".*) precmd () { let "len = 54 - ${#DISPLAY}" screen -X -S "$PPID" title "$DISPLAY - `pwd|sed -e 's:^.*\(.\{'$len'\}\)$:..\1:g'`" } preexec () { screen -X -S "$PPID" title "$DISPLAY - running: $1" # # Maybe $2 or $3 is a better choice - I didn't get the difference yet. You may # # analyse this with the statement: # printf "1:%s\n2:%s\n3:%s\n" "$1" "$2" "$3" >> "/tmp/preexec.$$.log" } ;; esac
show current directory or command in window name when using bash
This is the beginning of an humble try:
case "$STY" in "") ;; "$PPID".*) precmd () { let "len = 54 - ${#DISPLAY}" screen -X -S "$PPID" title "$DISPLAY - `pwd|sed -e 's:^.*\(.\{'$len'\}\)$:..\1:g'`" } preexec () { screen -X -S "$PPID" title "$DISPLAY - running: $1" # # Maybe $2 or $3 is a better choice - I didn't get the difference yet. You may # # analyse this with the statement: # printf "1:%s\n2:%s\n3:%s\n" "$1" "$2" "$3" >> "/tmp/preexec.$$.log" } if [ "$BASH" ] then PROMPT_COMMAND='precmd' screentitle() { preexec "$BASH_COMMAND"; } trap screentitle DEBUG fi # as we show user and cwd in screen title, # clear hardstatus in screen: echo -en "\033]0;\007" ;; esac
There might be a better approach at at twistedmatrix
sample .screenrc file
#remove some stupid / dangerous key bindings bind ^k bind ^\ bind k startup_message off vbell on vbell_msg " Klingeling! " bindkey -k kb stuff ^? defscrollback 500 caption always caption string "%?%F%{.c.}%?%3n %t%? [%h]%?" # caption string "%?%F%{.c.}%?%3n %?[%h]%:%t%?" windowlist string "%3n %t %?[%h]%?" hardstatus on hardstatus alwayslastline msgminwait 0
docs/tips_n_tricks/screen.html.1278518062.txt.gz · Last modified: 07.07.2010 17:54 CEST by peter