3 ## User-defined functions
7 \
which -p $1 >/dev
/null
2>&1
12 local my_color start stop pipe1 pipe2 hbar out
14 if [[ "$COLORS" == "true" ]]; then
15 my_color
=${2:-${BOLD_RED}}
19 if [[ $LINEDRAW == "true" ]]; then
20 # Some stuff to help us draw nice lines
21 start
="$terminfo[smacs]"
22 stop
="$terminfo[rmacs]"
23 hbar
="${start}${(l:$(( 74 - ${#1} - 5 ))::q:)}${stop}"
30 hbar
="${start}${(l:$((74 - ${#1} - 5))::-:)}${stop}"
35 out
="${my_color}${hbar}${start}"
37 if [[ "${1}" != "" ]]; then
38 out
+="${pipe1}${stop}${my_color} $1 ${my_color}${start}${pipe2}"
40 out
+="${draw}${draw}${draw}${draw}"
42 out
+="${draw}${stop}${NO_COLOR}\r"
49 if [ -e /etc
/login.defs
]; then
50 eval `grep -v '^[$#]' /etc/login.defs | grep "^UID_" | tr -d '[:blank:]' | sed 's/^[A-Z_]\+/&=/'`
51 [ \
( $UID -ge $UID_MIN \
) ]
53 [ "`whoami`" != "root" ]
64 if ( cmd_exists git
&& test -d .git
); then
65 # Shows tracked branches and modified files
66 git checkout HEAD
2>&1 |
sed 's/^/ /'
71 add-zsh-hook chpwd _jj_chpwd
78 # Taken from oh-my-zsh
80 function dirpersiststore
() {
81 dirs -p | perl
-e 'foreach (reverse <STDIN>) {chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"}' >|
$zdirstore
83 add-zsh-hook zshexit dirpersiststore
85 function dirpersistrestore
() {
86 if [ -f $zdirstore ]; then