Add maildir segment to agnoster theme

This commit is contained in:
Tiziano Santoro 2013-04-15 15:55:20 +01:00
commit 29b1272438

View file

@ -118,6 +118,22 @@ prompt_hg() {
fi
}
prompt_maildir() {
# Avoid zsh complaining for ** not matching anything.
unsetopt nomatch 2>/dev/null
# Only enable this segment if the $MAILDIR variable is set.
if [[ -n "$MAILDIR" ]] then
# $MAILDIR should be set to something like "~/Maildir/INBOX/new" for a single maildir, or
# "~/Maildir/**/INBOX/new" in case of multiple maildirs in the same folder (if using offlineimap
# or similar).
eval ls "$MAILDIR/*" >/dev/null 2>&1
# ls succeeds if there is at least one file matching the pattern.
if [[ $? -eq 0 ]] then
prompt_segment black red "M"
fi
fi
}
# Dir: current working directory
prompt_dir() {
prompt_segment blue black '%~'
@ -145,6 +161,7 @@ build_prompt() {
prompt_dir
prompt_git
prompt_hg
prompt_maildir
prompt_end
}