From a2f8f3d252e11bbe52ca6eb5d899eb174d0d8262 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Fri, 30 Mar 2012 17:21:11 -0400 Subject: Add task count to prompt --- .zshrc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to '.zshrc') diff --git a/.zshrc b/.zshrc index 62ee50b2..0b414afe 100644 --- a/.zshrc +++ b/.zshrc @@ -142,11 +142,14 @@ alias killlall='killall' alias irb='ripl' alias l='ls' -function prompt_char { - echo '%(!.#.$)' +setopt PROMPT_SUBST + +function prompt_task { + COUNT=$(task count -longterm) + [ "$COUNT" -gt 0 ] && echo "[%{$fg[red]%}$COUNT%{$fg[green]%}]" } -PROMPT="%{$terminfo[bold]$fg[green]%}[%{$fg[blue]%}%30<..<%~%{$fg[green]%}]%(!.#.$)%{$terminfo[sgr0]$reset_color%} " +PROMPT="%{$terminfo[bold]$fg[green]%}[%{$fg[blue]%}%30<..<%~%{$fg[green]%}]\$(prompt_task)%(!.#.$)%{$terminfo[sgr0]$reset_color%} " RPROMPT="%(?..%{$terminfo[bold]$fg[green]%}[%{$fg[red]%}%?%{$fg[green]%}]%{$terminfo[sgr0]%})" source ~/.zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -- cgit 1.4.1