diff options
-rw-r--r-- | .zlogin | 25 | ||||
-rw-r--r-- | 01_Functions.zsh | 44 | ||||
-rw-r--r-- | zshrc | 2 |
3 files changed, 40 insertions, 31 deletions
@@ -1,21 +1,14 @@ -:>.tmp.screen-list -if cmd_exists tmux -then - session_manager=tmux - tmux list-sessions | strings > .tmp.screen-list -elif cmd_exists screen -then - session_manager=screen - screen -list | strings | grep -v "^No Sockets found" >> .tmp.screen-list -fi -if [ -s .tmp.screen-list ] +cmd_exists keychain && eval $(keychain --eval --inherit any-once --quick) + +if cmd_exists fortune then - preprint "$session_manager" $color[bold] && echo - < .tmp.screen-list - rm -f .tmp.screen-list -fi + preprint "Pensée du jour" && echo + fortune fr + preprint "" && echo + echo +fi | sed 's/^/ /' -cmd_exists keychain && eval $(keychain --eval --inherit any-once --quick) +birthdays true diff --git a/01_Functions.zsh b/01_Functions.zsh index a935155..06f56e7 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -19,7 +19,7 @@ cmd_exists () { - which $1 2>/dev/null >&2 + whereis -b $1 2>/dev/null >&2 } term_title() @@ -78,15 +78,19 @@ term_title() preprint() { local my_color i - - my_color=${2-"$color[black];$color[bold]"} + my_color=${2-"$prompt_colors[generic]"} hbar= - for i in {1..$(($COLUMNS - ${#1} - 5))} + for i in {1..$((80 - ${#1} - 5))} do hbar=$hbar- done - print -Pn "${C_}$my_color${_C}${hbar}[ $1 ]-\r${C_}0${_C}" + if [ "$1" != "" ] + then + print -Pn "${C_}$my_color;1${_C}${hbar}[${C_}0;$my_color${_C} $1 ${C_}0;$my_color;1${_C}]-\r${C_}0${_C}" + else + print -Pn "${C_}$my_color;1${_C}${hbar}-----${C_}0${_C}" + fi } get_git_branch () @@ -287,7 +291,7 @@ set_prompt_colors () git_colors[up_to_date]="$prompt_colors[up_to_date]" # git up-to-date } -chpwd() +birthdays() { WHEN_FILE=~/.when/birthdays TODAY_FILE=~/.when/.today @@ -304,24 +308,38 @@ chpwd() if [ -s $TODAY_FILE ] then - preprint "événements" $color[bold] ; echo + preprint "À ne pas manquer" $color[red] ; echo cat $TODAY_FILE - fi + preprint "" $color[red] ; echo + echo + fi | sed 's/^/ /' fi +} +todo() +{ if cmd_exists todo then - if [ $(todo | wc -l) -gt 0 ] + TODO=${=$(whereis -b todo | cut -d: -f2)} + if [ $($TODO $@ | wc -l) -gt 0 ] then - preprint "todo" $color[bold] ; echo - todo - fi + preprint "À faire" $color[yellow] && echo + $TODO $@ --force-colour + preprint "" $color[yellow] && echo + echo + fi | sed 's/^/ /' fi +} + +chpwd() +{ + + todo if ( cmd_exists git && test -d .git ) then # Shows tracked branches and modified files - git-checkout HEAD + git-checkout HEAD 2>&1 | sed 's/^/ /' fi } @@ -96,5 +96,3 @@ then [ "`pwd`" = ~$SUDO_USER ] && cd fi -cmd_exists fortune && fortune fr - |