Skip to content

Instantly share code, notes, and snippets.

@derekjw
Created March 27, 2011 18:53
Show Gist options
  • Select an option

  • Save derekjw/889468 to your computer and use it in GitHub Desktop.

Select an option

Save derekjw/889468 to your computer and use it in GitHub Desktop.
diff to fix oh-my-zsh not working properly with screen
diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
index e1e5366..3b7b500 100644
--- a/lib/termsupport.zsh
+++ b/lib/termsupport.zsh
@@ -3,7 +3,7 @@
#Fully support screen, iterm, and probably most modern xterm and rxvt
#Limited support for Apple Terminal (Terminal can't set window or tab separately)
function title {
- if [[ "$TERM" == "screen" ]]; then
+ if [[ $TERM =~ "^screen" ]]; then
print -Pn "\ek$1\e\\" #set screen hardstatus, usually truncated at 20 chars
elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
print -Pn "\e]2;$2\a" #set window name
@@ -21,6 +21,8 @@ function precmd {
#Appears at the beginning of (and during) of command execution
function preexec {
+ emulate -L zsh
+ setopt extended_glob
local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
title "$CMD" "%100>...>$2%<<"
}
@nel
Copy link
Copy Markdown

nel commented Apr 1, 2011

Did you do a pull request upstream for this fix, this is definitly harmless (as the option is only set locally) and more bulletproof.

@derekjw
Copy link
Copy Markdown
Author

derekjw commented Apr 1, 2011

No I haven't. I'll clean up the commits in my repo and submit a pull request. Thanks for the reminder.

@nel
Copy link
Copy Markdown

nel commented Apr 4, 2011

Ok I had a fix to push myself so I included yours: ohmyzsh/ohmyzsh#266

@derekjw
Copy link
Copy Markdown
Author

derekjw commented Apr 4, 2011

Looks good, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment