From ebd06ef2b1ee15155f6a782cd6663f9ccae32e5b Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Mon, 20 Apr 2009 13:53:55 +0200 Subject: [Funcs] chpwd updated to show todo & when --- 01_Functions.zsh | 28 ++++++++++++++++++++++++++++ 12_Prompts.zsh | 5 ----- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/01_Functions.zsh b/01_Functions.zsh index b2d8dfc..acec467 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -215,4 +215,32 @@ set_prompt_colors () git_colors[up_to_date]="$prompt_colors[up_to_date]" # git up-to-date } +chpwd() +{ + if cmd_exists when && [ -e .when/.today ] + then + LATEST=`stat 2>&- --printf="%z\n" .when/.today | cut -d' ' -f1` + TODAY=`date "+%Y-%m-%d"` + + if [ "$TODAY" != "$LATEST" ] + then + when w --calendar=~/.when/birthdays | tail -n+3 > ~/.when/.today + fi + + if [ -s ~/.when/.today ] + then + preprint "événements" $color[bold] ; echo + cat ~/.when/.today + fi + fi + + if cmd_exists todo + then + if [ $(todo | wc -l) -gt 0 ] + then + preprint "todo" $color[bold] ; echo + todo + fi + fi +} diff --git a/12_Prompts.zsh b/12_Prompts.zsh index 1c182fa..e762a6b 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -326,11 +326,6 @@ precmd() redisplay_prompt } -chpwd() -{ - which todo > /dev/null 2>&1 && todo -} - # Prompt level 2 PS2="$C_$color[yellow];$color[bold]$_C%_$C_$color[none];$color[cyan];$color[bold]$_C>$C_$color[none]$_C " -- cgit v1.2.3