summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2009-04-20 13:53:55 +0200
committerHugues Hiegel <hugues@hiegel.fr>2009-04-20 13:53:55 +0200
commitebd06ef2b1ee15155f6a782cd6663f9ccae32e5b (patch)
treea7cbf7927175a457b04d4f180e286e849243720a
parent81f891e4c144e31416a505adc08ad2c0b03444d5 (diff)
[Funcs] chpwd updated to show todo & when
-rw-r--r--01_Functions.zsh28
-rw-r--r--12_Prompts.zsh5
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 "