Add task warrior integration in zsh prompt

‣ Display active tasks below directory
This commit is contained in:
Talia 2023-08-07 13:54:29 +02:00
parent 434cd3795d
commit 6cd768e6ab

16
zshrc
View file

@ -18,6 +18,14 @@ setopt hist_ignore_space
bindkey -v bindkey -v
task_prompt() {
tasks="$(task +ACTIVE export | jq -r '.[].description' | sed 's/^/‣ /')"
if [ -n "$tasks" ]
then
echo "\x1b[30m$tasks\n\x1b[0m"
fi
}
timew_prompt() { timew_prompt() {
if [ $(timew get dom.active) -eq "1" ] if [ $(timew get dom.active) -eq "1" ]
then echo '\x1b[31m●\x1b[0m ' then echo '\x1b[31m●\x1b[0m '
@ -25,7 +33,7 @@ timew_prompt() {
} }
ranger_prompt() { ranger_prompt() {
if [ -e "$RANGER_LEVEL" ] if [ -n "$RANGER_LEVEL" ]
then then
for num in $(seq "$RANGER_LEVEL") for num in $(seq "$RANGER_LEVEL")
do echo -n » do echo -n »
@ -33,10 +41,10 @@ ranger_prompt() {
fi fi
} }
prompt='%F{red}$(timew_prompt)%(?.%F{green}.%F{red})λ%F{blue}$(ranger_prompt)%f ' prompt='$(task_prompt)%(?.%F{green}.%F{red})λ%F{blue}$(ranger_prompt)%f '
export PROMPT_full='%B%F{magenta}%n%F{blue}@%F{magenta}%m%b %F{magenta}%~ export PROMPT_full='%F{red}$(timew_prompt)%B%F{magenta}%n%F{blue}@%F{magenta}%m%b %F{magenta}%~
'"$prompt" '"$prompt"
export PROMPT_gitlong='$(gitprompt && echo -ne " ")%F$(git log --oneline --no-decorate -1 2>/dev/null) export PROMPT_gitlong='%F{red}$(timew_prompt)$(gitprompt && echo -ne " ")%F$(git log --oneline --no-decorate -1 2>/dev/null)
%F{cyan}$(gitpath)'"$prompt" %F{cyan}$(gitpath)'"$prompt"
# export PS1tiny= # export PS1tiny=
# export PS1nano= # export PS1nano=