2021-02-18 09:43:11 +00:00
|
|
|
export HISTFILE=$HOME/.zsh_history
|
2021-02-26 07:23:22 +00:00
|
|
|
export SAVEHIST=10000
|
2021-02-18 09:43:11 +00:00
|
|
|
export HISTFILESIZE=10000
|
2021-03-02 10:19:58 +00:00
|
|
|
export HISTSIZE=10000
|
2021-02-18 14:05:37 +00:00
|
|
|
|
2022-06-04 08:10:12 +00:00
|
|
|
alias scratch="scratch $SHELL"
|
|
|
|
|
2021-08-23 16:30:52 +00:00
|
|
|
alias hgrep='history 0 | grep '
|
2021-02-26 07:23:22 +00:00
|
|
|
setopt append_history
|
|
|
|
setopt hist_find_no_dups
|
|
|
|
# setopt hist_ignore_dups
|
2021-02-18 09:43:11 +00:00
|
|
|
setopt inc_append_history
|
|
|
|
setopt extended_history
|
|
|
|
setopt hist_find_no_dups
|
|
|
|
# setopt hist_ignore_all_dups
|
2021-02-18 09:12:06 +00:00
|
|
|
setopt prompt_subst
|
2021-02-18 09:43:11 +00:00
|
|
|
setopt hist_ignore_space
|
2021-02-18 09:12:06 +00:00
|
|
|
|
2024-06-24 14:19:29 +00:00
|
|
|
autoload -z edit-command-line
|
|
|
|
zle -N edit-command-line
|
|
|
|
bindkey -M vicmd '\' edit-command-line
|
|
|
|
|
2024-02-06 16:38:47 +00:00
|
|
|
autoload -U compinit; compinit
|
|
|
|
|
2021-03-02 10:19:58 +00:00
|
|
|
bindkey -v
|
|
|
|
|
2023-09-01 10:31:53 +00:00
|
|
|
which task > /dev/null && which jq > /dev/null
|
|
|
|
run_task_prompt=$?
|
2023-08-07 11:54:29 +00:00
|
|
|
task_prompt() {
|
2023-09-13 07:26:08 +00:00
|
|
|
if [ $run_task_prompt -eq 0 ]
|
2023-08-07 11:54:29 +00:00
|
|
|
then
|
2024-06-24 14:20:27 +00:00
|
|
|
tasks="$(task rc.verbose: +ACTIVE export | jq -r '.[].description' | sed 's/^/‣ /')"
|
2023-09-01 10:31:53 +00:00
|
|
|
if [ -n "$tasks" ]
|
|
|
|
then
|
2023-09-25 11:53:19 +00:00
|
|
|
echo "%F{black}$tasks\n%{%}"
|
2023-09-01 10:31:53 +00:00
|
|
|
fi
|
2023-08-07 11:54:29 +00:00
|
|
|
fi
|
|
|
|
}
|
2023-09-26 07:30:38 +00:00
|
|
|
due_soon_prompt() {
|
|
|
|
if [ $run_task_prompt -eq 0 ]
|
|
|
|
then
|
2024-06-24 14:20:27 +00:00
|
|
|
if [ "$(task rc.verbose: +PENDING due.before:30min count)" -gt 0 ]; then
|
|
|
|
echo "%F{red}%B$(task rc.verbose: +PENDING +DUE count)%b "; return
|
2023-09-26 07:30:38 +00:00
|
|
|
fi
|
2024-06-24 14:20:27 +00:00
|
|
|
if [ "$(task rc.verbose: +PENDING due.before:1h count)" -gt 0 ]; then
|
|
|
|
echo "%F{yellow}%B$(task rc.verbose: +PENDING +DUE count)%b "; return
|
2023-09-26 07:30:38 +00:00
|
|
|
fi
|
2024-06-24 14:20:27 +00:00
|
|
|
if [ "$(task rc.verbose: +PENDING due.before:3h count)" -gt 0 ]; then
|
|
|
|
echo "%F{green}%B$(task rc.verbose: +PENDING +DUE count)%b "; return
|
2023-09-26 07:30:38 +00:00
|
|
|
fi
|
2024-06-24 14:20:27 +00:00
|
|
|
if [ "$(task rc.verbose: +PENDING due.before:tomorrow count)" -gt 0 ]; then
|
|
|
|
echo "%F{black}%B$(task rc.verbose: +PENDING +DUE count)%b "; return
|
2023-09-26 07:30:38 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
2023-08-07 11:54:29 +00:00
|
|
|
|
2023-09-01 10:31:53 +00:00
|
|
|
which timew > /dev/null
|
|
|
|
run_timew_prompt=$?
|
2023-08-07 11:25:15 +00:00
|
|
|
timew_prompt() {
|
2023-09-13 07:26:08 +00:00
|
|
|
if [ $run_timew_prompt -eq 0 ]
|
2023-09-01 10:31:53 +00:00
|
|
|
then
|
|
|
|
if [ $(timew get dom.active) -eq "1" ]
|
2023-09-25 11:53:19 +00:00
|
|
|
then echo '%F{red}● '
|
2023-09-01 10:31:53 +00:00
|
|
|
fi
|
2023-08-07 11:25:15 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
ranger_prompt() {
|
2023-08-07 11:54:29 +00:00
|
|
|
if [ -n "$RANGER_LEVEL" ]
|
2023-08-07 11:25:15 +00:00
|
|
|
then
|
|
|
|
for num in $(seq "$RANGER_LEVEL")
|
|
|
|
do echo -n »
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2023-08-07 11:54:29 +00:00
|
|
|
prompt='$(task_prompt)%(?.%F{green}.%F{red})λ%F{blue}$(ranger_prompt)%f '
|
2023-09-26 07:30:38 +00:00
|
|
|
export PROMPT_full='$(due_soon_prompt)%B%F{magenta}%n%F{blue}@%F{magenta}%m%b %F{magenta}%~
|
2021-02-18 09:12:06 +00:00
|
|
|
'"$prompt"
|
2023-09-26 07:30:38 +00:00
|
|
|
export PROMPT_gitlong='$(due_soon_prompt)$(gitprompt && echo -ne " ")%F$(git log --oneline --no-decorate -1 2>/dev/null)
|
2021-02-18 09:12:06 +00:00
|
|
|
%F{cyan}$(gitpath)'"$prompt"
|
|
|
|
# export PS1tiny=
|
|
|
|
# export PS1nano=
|
|
|
|
# export PS1nogit=
|
|
|
|
# export PS1git=
|
|
|
|
|
2021-02-19 07:27:47 +00:00
|
|
|
export HISTORY_IGNORE='(ls|vimswitch|clear)'
|
2021-02-18 09:43:11 +00:00
|
|
|
zshaddhistory() {
|
|
|
|
[[ $1 != ${~HISTORY_IGNORE} ]]
|
|
|
|
}
|
|
|
|
|
2021-02-18 09:12:06 +00:00
|
|
|
export PROMPT=$PROMPT_full
|
|
|
|
prompt() {
|
|
|
|
case $1 in
|
|
|
|
(full)
|
|
|
|
export PROMPT=$PROMPT_full;;
|
|
|
|
(gitlong)
|
|
|
|
export PROMPT=$PROMPT_gitlong;;
|
|
|
|
(*)
|
|
|
|
export PROMPT=$PROMPT_full;;
|
|
|
|
esac
|
|
|
|
export PROMPT_set=$1
|
|
|
|
}
|
|
|
|
prompt $PROMPT_set
|
2021-06-28 07:08:36 +00:00
|
|
|
|
2023-08-07 11:31:58 +00:00
|
|
|
source smartprompt
|
2021-06-28 07:08:36 +00:00
|
|
|
chpwd() {
|
2022-06-04 08:10:12 +00:00
|
|
|
source smartprompt
|
2021-06-28 07:08:36 +00:00
|
|
|
}
|