this repo has no description
at parsec 61 lines 1.8 kB view raw
1prompt_faraday_overmind_sock () { 2 if [[ -e .overmind.sock ]]; then 3 echo "" 4 else 5 echo "" 6 fi 7} 8 9prompt_faraday_precmd () { 10 print -Pn '\e]0;%~\a' # show the full path in the window title 11 vcs_info # ensure vcs plugin has pulled info 12 13 PROMPT="%F{#777788}%D{%H:%M} %(?.%F{#9999bb}.%F{#ff8888})%(!.#.>)%f " 14 RPROMPT="%F{#daa520}$(prompt_faraday_overmind_sock)%F{#dddddd}${vcs_info_msg_0_} %F{#99ccff}%2~%f" 15} 16 17prompt_faraday_setup () { 18 autoload -Uz add-zsh-hook 19 autoload -Uz vcs_info 20 21 zstyle ':vcs_info:*' enable jj git 22 zstyle ':vcs_info:*' check-for-changes true 23 24 # format for git 25 zstyle ':vcs_info:git*+set-message:*' hooks git-time-since-commit 26 zstyle ':vcs_info:git*' formats ' %F{#777788}[%s] %F{#AAAABB}%b %F{#777788}[%m]%f ' 27 zstyle ':vcs_info:git*' actionformats ' %b|%a %F{#777788}[%s][%m]%f' 28 29 # format for jj 30 zstyle ':vcs_info:jj:*' formats ' %F{#777788}[%s] %f%i %F{#AAAABB}%m%f ' '%b' 31 zstyle ':vcs_info:jj:*' actionformats '%a|%i' '%b' 32 33 add-zsh-hook precmd prompt_faraday_precmd 34 prompt_faraday_precmd 35} 36 37function +vi-git-time-since-commit() { 38 local last_commit_epoch=$(git log -1 --format=%ct 2>/dev/null) 39 if [[ -z "$last_commit_epoch" ]]; then 40 return 0 41 fi 42 43 local current_epoch=$(date +%s) 44 local diff_seconds=$((current_epoch - last_commit_epoch)) 45 46 local time_since_commit 47 if (( diff_seconds < 60 )); then 48 time_since_commit="${diff_seconds}s" 49 elif (( diff_seconds < 3600 )); then 50 time_since_commit="$((diff_seconds / 60))m" 51 elif (( diff_seconds < 86400 )); then 52 time_since_commit="$((diff_seconds / 3600))h" 53 else 54 time_since_commit="$((diff_seconds / 86400))d" 55 fi 56 57 hook_com[misc]+=$time_since_commit 58 return 0 59} 60 61prompt_faraday_setup "$@"