]>
git.rmz.io Git - dotfiles.git/blob - zsh/plugins/screen/screen.plugin.zsh
7009e7a91bcdf1294353af7e9394b2ef97feedeb
1 # if using GNU screen, let the zsh tell screen what the title and hardstatus
2 # of the tab window should be.
3 if [[ "$TERM" == screen
* ]]; then
4 if [[ $_GET_PATH == '' ]]; then
5 _GET_PATH
='echo $PWD | sed "s/^\/Users\//~/;s/^\/home\//~/;s/^~$USER/~/"'
7 if [[ $_GET_HOST == '' ]]; then
8 _GET_HOST
='echo $HOST | sed "s/\..*//"'
11 # use the current user as the prefix of the current tab title
12 TAB_TITLE_PREFIX
='"`'$_GET_HOST'`:`'$_GET_PATH' | sed "s:..*/::"`$PROMPT_CHAR"'
13 # when at the shell prompt, show a truncated version of the current path (with
14 # standard ~ replacement) as the rest of the title.
15 TAB_TITLE_PROMPT
='$SHELL:t'
16 # when running a command, show the title of the command as the rest of the
17 # title (truncate to drop the path to the command)
18 TAB_TITLE_EXEC
='$cmd[1]:t'
20 # use the current path (with standard ~ replacement) in square brackets as the
21 # prefix of the tab window hardstatus.
22 TAB_HARDSTATUS_PREFIX
='"[`'$_GET_PATH'`] "'
23 # when at the shell prompt, use the shell name (truncated to remove the path to
24 # the shell) as the rest of the title
25 TAB_HARDSTATUS_PROMPT
='$SHELL:t'
26 # when running a command, show the command name and arguments as the rest of
28 TAB_HARDSTATUS_EXEC
='$cmd'
30 # tell GNU screen what the tab window title ($1) and the hardstatus($2) should be
33 # set the tab window title (%t) for screen
34 print
-nR $
'\033k'$1$
'\033'\\\
36 # set hardstatus of tab window (%h) for screen
37 print
-nR $
'\033]0;'$2$
'\a'
39 # called by zsh before executing a command
42 local -a cmd
; cmd
=(${(z)1}) # the command string
43 eval "tab_title=$TAB_TITLE_PREFIX:$TAB_TITLE_EXEC"
44 eval "tab_hardstatus=$TAB_HARDSTATUS_PREFIX:$TAB_HARDSTATUS_EXEC"
45 screen_set
$tab_title $tab_hardstatus
47 # called by zsh before showing the prompt
50 eval "tab_title=$TAB_TITLE_PREFIX:$TAB_TITLE_PROMPT"
51 eval "tab_hardstatus=$TAB_HARDSTATUS_PREFIX:$TAB_HARDSTATUS_PROMPT"
52 screen_set
$tab_title $tab_hardstatus