4 # TERM is one of the variables that is usually allowed to be
5 # transmitted to the remote session. The remote host should have the
6 # appropriate termcap or terminfo file to handle the TERM you
7 # provided. When connecting to random hosts, this may not be the
8 # case if your TERM is somewhat special. A good fallback is
9 # xterm. Most terminals are compatible with xterm and all hosts have
10 # a termcap or terminfo file to handle xterm. Therefore, for some
11 # values of TERM, we fallback to xterm.
13 # Now, you may connect to a host where your current TERM is fully
14 # supported and you will get xterm instead (which means 8 base
15 # colors only). There is no clean solution for this. You may want to
16 # reexport the appropriate TERM when logged on the remote host or
17 # use commands like this: ssh -t XXXXX env TERM=$TERM emacsclient -t
20 # If the remote host uses the same zshrc than this one, there is
21 # something in `$ZSH/rc/00-terminfo.zsh` to restore the appropriate
22 # terminal (saved in `LC__ORIGINALTERM`).
24 # The problem is quite similar for LANG and LC_MESSAGES. We reset
25 # them to C to avoid any problem with hosts not having your locally
26 # installed locales. See this post for more details on this:
27 # http://vincent.bernat.im/en/blog/2011-zsh-zshrc.html
29 # Also, when the same ZSH configuration is used on the remote host,
30 # the locale is reset with the help of 12-Locale.zsh
32 rxvt-256color|rxvt-unicode|rxvt-unicode-256color)
33 LC__ORIGINALTERM=$TERM TERM=rxvt LANG=C LC_MESSAGES=C command ssh "$@"
36 LANG=C LC_MESSAGES=C command ssh "$@"
41 _jj_first_non_optional_arg() {
44 args=( ${(R)args:#-*} )
53 title=${@//[^[:alnum:]\/>< ._~:=?@-]/ }
56 print -n "\ek$title\e\\"
57 print -n "\e]1;$title\a"
58 print -n "\e]2;$title\a"
61 print -n "\e]1;$title\a"
62 print -n "\e]2;$title\a"
67 _jj_title $(_jj_first_non_optional_arg "$@")