From 6cd768e6abf4d177e5ff0085f459ea2a502ee6a0 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Mon, 7 Aug 2023 13:54:29 +0200 Subject: [PATCH] Add task warrior integration in zsh prompt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ‣ Display active tasks below directory --- zshrc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/zshrc b/zshrc index afce503..59978af 100644 --- a/zshrc +++ b/zshrc @@ -18,6 +18,14 @@ setopt hist_ignore_space 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() { if [ $(timew get dom.active) -eq "1" ] then echo '\x1b[31m●\x1b[0m ' @@ -25,7 +33,7 @@ timew_prompt() { } ranger_prompt() { - if [ -e "$RANGER_LEVEL" ] + if [ -n "$RANGER_LEVEL" ] then for num in $(seq "$RANGER_LEVEL") do echo -n » @@ -33,10 +41,10 @@ ranger_prompt() { fi } -prompt='%F{red}$(timew_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}%~ +prompt='$(task_prompt)%(?.%F{green}.%F{red})λ%F{blue}$(ranger_prompt)%f ' +export PROMPT_full='%F{red}$(timew_prompt)%B%F{magenta}%n%F{blue}@%F{magenta}%m%b %F{magenta}%~ '"$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" # export PS1tiny= # export PS1nano=