0294487a3e4c7e0257cc8f17357e497fd9280a3b
- Author
- Fredrik Appelberg <fredrik.appelberg@gmail.com>
- Committer
- Fredrik Appelberg <fredrik.appelberg@gmail.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/.gitignore b/.gitignore
2index 8d19d100c593afe9d4524f55b84c4b6c45eafbbd..2cf59326973364d355e8f91916907dcc781b292c 100644
3--- a/.gitignore
4+++ b/.gitignore
5@@ -2,4 +2,5 @@ locals.zsh
6 log/.zsh_history
7 projects.zsh
8 custom/*
9-!custom/example.zsh
10+!custom/example.zshcache
11+cache/
12diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
13index e1e536690be580eb0c99a1df47ad5b3df9494073..d7c2b9def8967bb9b9451b1f7eced2346a4d4203 100644
14--- a/lib/termsupport.zsh
15+++ b/lib/termsupport.zsh
16@@ -5,7 +5,7 @@
17 function title {
18 if [[ "$TERM" == "screen" ]]; then
19 print -Pn "\ek$1\e\\" #set screen hardstatus, usually truncated at 20 chars
20- elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
21+ elif [[ ("$TERM" =~ "^xterm") ]] || [[ ("$TERM" == "rxvt") ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
22 print -Pn "\e]2;$2\a" #set window name
23 print -Pn "\e]1;$1\a" #set icon (=tab) name (will override window name on broken terminal)
24 fi
25diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh
26index abd0da1850e0c92af8c1f30bf056c2673bf21fa1..e8af2f49d5d2f87daeae99b23d59fecdc7b44d26 100644
27--- a/plugins/mvn/mvn.plugin.zsh
28+++ b/plugins/mvn/mvn.plugin.zsh
29@@ -1,6 +1,6 @@
30 function listMavenCompletions {
31 reply=(
32diff --git a/plugins/screen/screen.plugin.zsh b/plugins/screen/screen.plugin.zsh
33new file mode 100644
34index 0000000000000000000000000000000000000000..ba7ac67e71e6f3b2bb000d4e39e94ca8a2c10e4c
35--- /dev/null
36+++ b/plugins/screen/screen.plugin.zsh
37@@ -0,0 +1,54 @@
38+# if using GNU screen, let the zsh tell screen what the title and hardstatus
39+# of the tab window should be.
40+if [[ $TERM == "screen" ]]; then
41+ if [[ $_GET_PATH == '' ]]; then
42+ _GET_PATH='echo $PWD | sed "s/^\/Users\//~/;s/^~$USER/~/"'
43+ fi
44+ if [[ $_GET_HOST == '' ]]; then
45+ _GET_HOST='echo $HOST | sed "s/\..*//"'
46+ fi
47+
48+ # use the current user as the prefix of the current tab title
49+ TAB_TITLE_PREFIX='"`'$_GET_HOST'`:`'$_GET_PATH' | sed "s:..*/::"`$PROMPT_CHAR"'
50+ # when at the shell prompt, show a truncated version of the current path (with
51+ # standard ~ replacement) as the rest of the title.
52+ TAB_TITLE_PROMPT='$SHELL:t'
53+ # when running a command, show the title of the command as the rest of the
54+ # title (truncate to drop the path to the command)
55+ TAB_TITLE_EXEC='$cmd[1]:t'
56+
57+ # use the current path (with standard ~ replacement) in square brackets as the
58+ # prefix of the tab window hardstatus.
59+ TAB_HARDSTATUS_PREFIX='"[`'$_GET_PATH'`] "'
60+ # when at the shell prompt, use the shell name (truncated to remove the path to
61+ # the shell) as the rest of the title
62+ TAB_HARDSTATUS_PROMPT='$SHELL:t'
63+ # when running a command, show the command name and arguments as the rest of
64+ # the title
65+ TAB_HARDSTATUS_EXEC='$cmd'
66+
67+ # tell GNU screen what the tab window title ($1) and the hardstatus($2) should be
68+ function screen_set()
69+ {
70+ # set the tab window title (%t) for screen
71+ print -nR $'\033k'$1$'\033'\\\
72+
73+ # set hardstatus of tab window (%h) for screen
74+ print -nR $'\033]0;'$2$'\a'
75+ }
76+ # called by zsh before executing a command
77+ function preexec()
78+ {
79+ local -a cmd; cmd=(${(z)1}) # the command string
80+ eval "tab_title=$TAB_TITLE_PREFIX:$TAB_TITLE_EXEC"
81+ eval "tab_hardstatus=$TAB_HARDSTATUS_PREFIX:$TAB_HARDSTATUS_EXEC"
82+ screen_set $tab_title $tab_hardstatus
83+ }
84+ # called by zsh before showing the prompt
85+ function precmd()
86+ {
87+ eval "tab_title=$TAB_TITLE_PREFIX:$TAB_TITLE_PROMPT"
88+ eval "tab_hardstatus=$TAB_HARDSTATUS_PREFIX:$TAB_HARDSTATUS_PROMPT"
89+ screen_set $tab_title $tab_hardstatus
90+ }
91+fi