3 ## User-defined functions
7 \
which -p $1 >/dev
/null
2>&1
13 my_color
=${2-"$prompt_colors[generic]"}
16 for i
in {1..$
((74 - ${#1} - 5))}; do
21 if [ "$1" != "" ]; then
22 print
-Pn "${C_}$my_color;1${_C}${hbar}$T_$_t_u$_T${C_}0;$my_color${_C} $1 ${C_}0;$my_color;1${_C}$T_$_t_t$_t_q$_T\r${C_}0${_C}"
24 print
-Pn "${C_}$my_color;1${_C}${hbar}$T_$_t_q$_t_q$_t_q$_t_q$_t_q$_T${C_}0${_C}"
31 if [ -e /etc
/login.defs
]; then
32 eval `grep -v '^[$#]' /etc/login.defs | grep "^UID_" | tr -d '[:blank:]' | sed 's/^[A-Z_]\+/&=/'`
33 [ \
( $UID -ge $UID_MIN \
) ]
35 [ "`whoami`" != "root" ]
46 if ( cmd_exists git
&& test -d .git
); then
47 # Shows tracked branches and modified files
48 git checkout HEAD
2>&1 |
sed 's/^/ /'
52 # Taken from oh-my-zsh
54 dirs -p | perl
-e 'foreach (reverse <STDIN>) {chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"}' >|
$zdirstore
57 dirpersistrestore
() {
58 if [ -f $zdirstore ]; then
64 history |
awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' |
grep -v "./" |
column -c3 -s " " -t |
sort -nr |
nl |
head -n20
68 # TERM is one of the variables that is usually allowed to be
69 # transmitted to the remote session. The remote host should have the
70 # appropriate termcap or terminfo file to handle the TERM you
71 # provided. When connecting to random hosts, this may not be the
72 # case if your TERM is somewhat special. A good fallback is
73 # xterm. Most terminals are compatible with xterm and all hosts have
74 # a termcap or terminfo file to handle xterm. Therefore, for some
75 # values of TERM, we fallback to xterm.
77 # Now, you may connect to a host where your current TERM is fully
78 # supported and you will get xterm instead (which means 8 base
79 # colors only). There is no clean solution for this. You may want to
80 # reexport the appropriate TERM when logged on the remote host or
81 # use commands like this: ssh -t XXXXX env TERM=$TERM emacsclient -t
84 # If the remote host uses the same zshrc than this one, there is
85 # something in `$ZSH/rc/00-terminfo.zsh` to restore the appropriate
86 # terminal (saved in `LC__ORIGINALTERM`).
88 # The problem is quite similar for LANG and LC_MESSAGES. We reset
89 # them to C to avoid any problem with hosts not having your locally
90 # installed locales. See this post for more details on this:
91 # http://vincent.bernat.im/en/blog/2011-zsh-zshrc.html
93 # Also, when the same ZSH configuration is used on the remote host,
94 # the locale is reset with the help of 12-Locale.zsh
96 rxvt-256color|rxvt-unicode
*)
97 LC__ORIGINALTERM
=$TERM TERM
=xterm LANG
=C LC_MESSAGES
=C
command ssh "$@"
100 LANG
=C LC_MESSAGES
=C
command ssh "$@"
105 _jj_first_non_optional_arg
() {
108 args
=( ${(R)args:#-*} )
117 title
=${@//[^[:alnum:]\/>< ._~:=?@-]/ }
120 print
-n "\ek$title\e\\"
121 print
-n "\e]1;$title\a"
122 print
-n "\e]2;$title\a"
125 print
-n "\e]1;$title\a"
126 print
-n "\e]2;$title\a"
132 _jj_title $
(_jj_first_non_optional_arg
"$@")