X-Git-Url: https://git.madduck.net/etc/zsh.git/blobdiff_plain/e7b57bc5c5383a6eac9b7d8d0af4f1c63723b948..9d300c3a4c26acfa2efc1f51caea35c5365eddba:/.zsh/themes/prompt_madduck_setup?ds=inline diff --git a/.zsh/themes/prompt_madduck_setup b/.zsh/themes/prompt_madduck_setup index 0b6dddc..3f0f3e5 100644 --- a/.zsh/themes/prompt_madduck_setup +++ b/.zsh/themes/prompt_madduck_setup @@ -59,7 +59,7 @@ __git_print_preprompt() function output() { emulate -L zsh local title="$@" - local output=(${(f)"$(cat)"}) + local output; output=(${(f)"$(cat)"}) [[ ${#output} -ge 1 ]] || return @@ -81,8 +81,8 @@ __git_print_preprompt() eval git diff $common_options "$@" 2>/dev/null } - local cached=(${(f)"$(gitdiffstat --cached | output cached)"}) - local changed=(${(f)"$(gitdiffstat | output changed)"}) + local cached; cached=(${(f)"$(gitdiffstat --cached | output cached)"}) + local changed; changed=(${(f)"$(gitdiffstat | output changed)"}) local max=${#changed} [[ $max -lt ${#cached} ]] && max=${#cached} @@ -141,6 +141,11 @@ __vcs_get_repo_type() { emulate -L zsh # return the type of the closest repository in the path hierarchy + # unless we're on a network filesystem: + if __on_networkfs; then + echo netfs + return + fi local dir while true; do [ -d ${dir}.git ] && echo git && break @@ -259,7 +264,7 @@ __vcs_set_prompt_variables() ;; *) case "$repotype" in - NONE) :;; + NONE|netfs) :;; *) warn "$repotype repositories not (yet) supported in the prompt";; esac local MAXLEN MINLEN @@ -293,9 +298,11 @@ if ! is_root; then _update_vcs_prompt_vars_if_vcs_ran() { local vcs="$(__vcs_get_repo_type)" - case "$(history $(($HISTCMD - 1)))" in + case "$vcs/$(history $(($HISTCMD - 1)))" in # $vcs appeared in last command, so be sure to update - *${vcs}*) __vcs_set_prompt_variables "$vcs" + NONE/*) :;; + netfs/*) :;; + */*${vcs}*) __vcs_set_prompt_variables "$vcs" esac } add-zsh-hook precmd _update_vcs_prompt_vars_if_vcs_ran @@ -363,7 +370,7 @@ function make_rps1() { echo -n '%D{%d %H:%M:%S.%.}' echo } -RPS1=$(make_rps1) +typeset -g RPS1="$(make_rps1)" unfunction make_rps1 # vim:ft=zsh