3 ## User-defined functions
7 local my_color start stop pipe1 pipe2 hbar out
9 if [[ "$COLORS" == "true" ]]; then
10 my_color
=${2:-${BOLD_RED}}
14 if [[ $LINEDRAW == "true" ]]; then
15 # Some stuff to help us draw nice lines
16 if isutf8 || isconsole
; then
25 start
="$terminfo[smacs]"
26 stop
="$terminfo[rmacs]"
38 hbar
="${start}${${(l:$(( 74 - ${#1} - 5 ))::X:)}//X/$draw}${stop}"
39 out
="${my_color}${hbar}${start}"
41 if [[ "${1}" != "" ]]; then
42 out
+="${pipe1}${stop}${my_color} $1 ${my_color}${start}${pipe2}"
46 out
+="${draw}${stop}${NO_COLOR}\r"
53 if ( is-callable git
&& test -d .git
); then
54 # Shows tracked branches and modified files
55 git checkout HEAD
2>&1 |
sed 's/^/ /'
60 add-zsh-hook chpwd _jj_chpwd
67 # Idea taken from oh-my-zsh, but code is different
68 function dirpersistrestore
() {
69 if [ -f ${DIRSTACKFILE} ]; then
70 dirstack
=( ${(f)"$(< ${DIRSTACKFILE} )"} )
71 if zstyle
-t ':ganneff:config' dirstackhandling dirpersist
; then
77 function dirpersiststore
() {
78 print
-l ${(Oau)dirstack} ${PWD} >| ${DIRSTACKFILE}
82 add-zsh-hook zshexit dirpersiststore
84 echo "Sorry, zsh version too old"