Commits

Wes Alvaro committed 7c39508

More tricks for ZSH

Comments (0)

Files changed (1)

 
 PATH=$PATH:/sbin/ # For ipconfig
 
+precmd () {
+  if [[ "$TERM" = "screen" ]]; then
+    local pwd=`basename $PWD`
+    echo -ne "\ek"$pwd"\e\\"
+  fi
+}
+preexec () {
+  if [[ "$TERM" = "screen" ]]; then
+    local cmd="$1"
+    if [[ ${#cmd} -ge 15 ]]; then
+      CMD="${${(z)cmd}[1]}"
+    fi
+    echo -ne "\ek${cmd}\e\\"
+  fi
+}
 myScreen() {
     echo $STY;
 }
 myScreens() {
     screen -ls | grep "${ASext}"
 }
-title(){
-    PROMPT_COMMAND='echo -ne "\033k'"$@"'\033\\"'
-}
 autoScreenMe() {
-  if [[ "$STY" == "" ]]; then # best I can tell, we're not in a screen, yet
-    if [[ "$TERM" == "screen" ]]; then # we are on another box sshing from screen
-      local hostname=`hostname -s`
-      title $hostname
-    fi
+  if [[ "$TERM" != "screen" ]]; then # best I can tell, we're not in a screen, yet
     local screenHere="$sharedFolder/.screenHere"
     local screenOn="$sharedFolder/.screenOn"
     touch $screenHere
 alias mss='myScreens'
 
 ssh() { 
-  if [[ "$STY" != "" ]]; then 
+  if [[ "$TERM" == "screen" ]]; then 
     local timestamp=$(( `date "+%s"` + 120 ))
     local dateFormat="+%y%m%d%H%M.%S"
     local future=`date --date "1970-01-01 $timestamp sec" "$dateFormat"`
     local sharedFile="$sharedFolder/.screenOn"
-    # Get remote information
     echo "$STY:$WINDOW" > $sharedFile # Dial in the Stargate
     touch -t $future $sharedFile # Make shared file 120 seconds in the future
     command ssh "$@"; # Jump