aboutsummaryrefslogtreecommitdiffhomepage
path: root/zsh/zshrc
diff options
context:
space:
mode:
Diffstat (limited to 'zsh/zshrc')
-rw-r--r--zsh/zshrc25
1 files changed, 5 insertions, 20 deletions
diff --git a/zsh/zshrc b/zsh/zshrc
index 17c6018..7380d8e 100644
--- a/zsh/zshrc
+++ b/zsh/zshrc
@@ -36,18 +36,6 @@ _comp_options+=(globdots) # With hidden files
36zstyle ':completion:*' menu select 36zstyle ':completion:*' menu select
37zstyle ':completion::complete:*' gain-privileges 1 37zstyle ':completion::complete:*' gain-privileges 1
38 38
39function _already_sync_after_wakeup() {
40 WAKEUP="$HOME/.wakeup"
41 [ ! -e "$WAKEUP" ] && return 0
42
43 latest=$(date -d @`stat -c %X "$WAKEUP"` +%s)
44 # If sync time is older than wakeup time (timestamp in file), then return false
45 if [ $latest -gt "$(cat $WAKEUP)" ]; then
46 return 0
47 else
48 return 1
49 fi
50}
51 39
52autoload -Uz add-zsh-hook 40autoload -Uz add-zsh-hook
53autoload -Uz parameter 41autoload -Uz parameter
@@ -64,13 +52,6 @@ function precmd() {
64 fi 52 fi
65 PROMPT="%B%(?:%F{green}%m%f:%K{red}%F{black}%m%f%k)%f%F{cyan} %c%f%b${jobstring} " 53 PROMPT="%B%(?:%F{green}%m%f:%K{red}%F{black}%m%f%k)%f%F{cyan} %c%f%b${jobstring} "
66 54
67 # RIGHT PROMPT
68 # Show context and git status of tracking repos at right
69 UNSYNC_REPOS=$(NUM=$($SETTING_DIR/bin/git/check-repos.sh -n); (( $NUM != 0 )) && echo $NUM)
70 NEED_SYNC=$(_already_sync_after_wakeup || echo S)
71 RPROMPT="%B%K{blue}%F{yellow}${CONTEXT:+ $CONTEXT }%f%k%K{red}%F{black}${UNSYNC_REPOS}${NEED_SYNC}%f%k%b"
72
73
74 [ -n "$PRE_POPULATE" ] && print -z "$PRE_POPULATE" 55 [ -n "$PRE_POPULATE" ] && print -z "$PRE_POPULATE"
75} 56}
76 57
@@ -147,4 +128,8 @@ case ":$PATH:" in
147esac 128esac
148# pnpm end 129# pnpm end
149 130
150source ~/.profile 131source ~/.profile 2>/dev/null
132
133# Makefile
134zstyle ':completion:*:make:*:targets' call-command true
135zstyle ':completion:*:*:make:*' tag-order 'targets' 2>/dev/null