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
10 # Most terminals are compatible with xterm and all hosts have
11 # a termcap or terminfo file to handle xterm. But as it is incompatible
12 # in some annoying ways with default rxvt, we fall back to rxvt.
13 # (Some keys are different).
15 # Now, you may connect to a host where your current TERM is fully
16 # supported and you will get rxvt instead (which means 8 base
17 # colors only). There is no clean solution for this. You may want to
18 # reexport the appropriate TERM when logged on the remote host or
19 # use commands like this: ssh -t XXXXX env TERM=$TERM emacsclient -t
22 # If the remote host uses the same zshrc than this one, there is
23 # something in its config to restore the appropriate terminal (saved
24 # in `LC__ORIGINALTERM`).
26 # The problem is quite similar for LANG and LC_MESSAGES. We reset
27 # them to C to avoid any problem with hosts not having your locally
28 # installed locales. See this post for more details on this:
29 # http://vincent.bernat.im/en/blog/2011-zsh-zshrc.html
31 # Also, when the same ZSH configuration is used on the remote host,
32 # the locale is reset to useful values.
34 rxvt-256color|rxvt-unicode|rxvt-unicode-256color)
35 LC__ORIGINALTERM=$TERM TERM=rxvt LANG=C LC_MESSAGES=C command ssh "$@"
38 LANG=C LC_MESSAGES=C command ssh "$@"
43 _jj_first_non_optional_arg() {
46 args=( ${(R)args:#-*} )
55 title=${@//[^[:alnum:]\/>< ._~:=?@-]/ }
58 print -n "\ek$title\e\\"
59 print -n "\e]1;$title\a"
60 print -n "\e]2;$title\a"
63 print -n "\e]1;$title\a"
64 print -n "\e]2;$title\a"
69 _jj_title $(_jj_first_non_optional_arg "$@")