Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix zshrc issue with tmux, remove nasty command time tracking hack

  • Loading branch information...
commit 513bae534b9be9ca53173e0000db2824f1f0391a 1 parent 941e9bf
Andrew Thompson authored

Showing 1 changed file with 35 additions and 46 deletions. Show diff stats Hide diff stats

  1. +35 46 .zshrc
81 .zshrc
@@ -39,7 +39,7 @@ export PATH=$HOME/bin:$PATH
39 39
40 40 # make home/end work in as many places as possible
41 41 case $TERM in
42   - *xterm*|*rxvt|(dt|k|E|a)term|vt100)
  42 + *xterm*|*rxvt|(dt|k|E|a)term|vt100)
43 43 case `uname -s` in
44 44 SunOS|NetBSD|IRIX*|DragonFly|OpenBSD)
45 45 bindkey "\e[H" beginning-of-line
@@ -50,33 +50,18 @@ case $TERM in
50 50 bindkey "\e[8~" end-of-line
51 51 ;;
52 52 esac
53   - ;;
54   - screen*)
55   - bindkey "\e[1~" beginning-of-line
56   - bindkey "\e[4~" end-of-line
57   - ;;
  53 + ;;
  54 + screen*)
  55 + bindkey "\e[1~" beginning-of-line
  56 + bindkey "\e[4~" end-of-line
  57 + ;;
58 58 cons25)
59   - # TODO - check this on NETBSD and other OSes
60   - bindkey "\e[H" beginning-of-line
61   - bindkey "\e[F" end-of-line
62   - ;;
  59 + # TODO - check this on NETBSD and other OSes
  60 + bindkey "\e[H" beginning-of-line
  61 + bindkey "\e[F" end-of-line
  62 + ;;
63 63 esac
64 64
65   -# bind ^P to show start/end times of previous command
66   -displaytimes() {
67   - if [ "x$STARTTIME" != "x" ]; then
68   - # giant hack to trick the prompt into containing the timestamps..
69   - OPROMPT=$PROMPT
70   - PROMPT="${STARTTIME} - ${ENDTIME}
71   -${PROMPT}"
72   - zle reset-prompt
73   - PROMPT=$OPROMPT
74   - fi
75   -}
76   -zle -N displaytimes
77   -
78   -bindkey "^P" displaytimes
79   -
80 65 # Aliases, how I love thee
81 66 alias mutt="mutt -y"
82 67 alias rdesktop="rdesktop -g 90% -a 8"
@@ -128,33 +113,37 @@ export NC=$'%{\e[0m%}'
128 113 # prompt. If you're using screen, it sets the window title (works
129 114 # wonderfully for hardstatus lines :)
130 115 precmd () {
131   - ENDTIME=`date`
132   - [[ -t 1 ]] || return
133   - case $TERM in
134   - *xterm*|*rxvt|(dt|k|E|a)term) print -Pn "\e]2;%n@%m::%(3~,../%20<<%2~,%20<../<%~)\a"
135   - ;;
136   - screen*) print -Pn "\e\"%n@%m::%(3~,../%15<<%2~,%15<../<%~)\e\134"
137   - esac
  116 + [[ -t 1 ]] || return
  117 + case $TERM in
  118 + *xterm*|*rxvt|(dt|k|E|a)term)
  119 + print -Pn "\e]2;%n@%m::%(3~,../%20<<%2~,%20<../<%~)\a"
  120 + ;;
  121 + screen*)
  122 + # tmux already knows how to do this
  123 + if [ "x$TMUX" = "x" ]; then
  124 + print -Pn "\e\"%n@%m::%(3~,../%15<<%2~,%15<../<%~)\e\134"
  125 + fi
  126 + ;;
  127 + esac
138 128 }
139 129
140   -# This sets the window title to the last run command.
141   -#[[ -t 1 ]] || return
142   -
143 130 preexec() {
144   - STARTTIME=`date`
145 131 case $TERM in
146 132 *xterm*|*rxvt|(dt|k|E|a)term)
147   - # if we're doing some screen shit, set the window title to
148   - # screen@hostname instead of the generic screen -x or whatever
149   - if [[ $1 == screen ]] || [[ ${${=1}[0]} == screen ]]; then
150   - print -Pn "\e]2;screen@%M\a"
151   - else
152   - print -Pn "\e]2;%20>..>$1%<<\a"
153   - fi
154   - ;;
  133 + # if we're doing some screen shit, set the window title to
  134 + # screen@hostname instead of the generic screen -x or whatever
  135 + if [[ $1 == screen ]] || [[ ${${=1}[0]} == screen ]]; then
  136 + print -Pn "\e]2;screen@%M\a"
  137 + else
  138 + print -Pn "\e]2;%20>..>$1%<<\a"
  139 + fi
  140 + ;;
155 141 screen*)
156   - print -Pn "\e\"%15>..>$1%<<\e\134"
157   - ;;
  142 + # tmux already knows how to do this
  143 + if [ "x$TMUX" = "x" ]; then
  144 + print -Pn "\e\"%15>..>$1%<<\e\134"
  145 + fi
  146 + ;;
158 147 esac
159 148 }
160 149

0 comments on commit 513bae5

Please sign in to comment.
Something went wrong with that request. Please try again.