]>
git.madduck.net Git - etc/zsh.git/blobdiff - .zsh/themes/prompt_madduck_setup
madduck's git repository
Every one of the projects in this repository is available at the canonical
URL git://git.madduck.net/madduck/pub/<projectpath> — see
each project's metadata for the exact URL.
All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@ git. madduck. net .
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
SSH access, as well as push access can be individually
arranged .
If you use my repositories frequently, consider adding the following
snippet to ~/.gitconfig and using the third clone URL listed for each
project:
[url "git://git.madduck.net/madduck/"]
insteadOf = madduck:
function output() {
emulate -L zsh
local title="$@"
function output() {
emulate -L zsh
local title="$@"
- local output=(${(f)"$(cat)"})
+ local output; output =(${(f)"$(cat)"})
[[ ${#output} -ge 1 ]] || return
[[ ${#output} -ge 1 ]] || return
eval git diff $common_options "$@" 2>/dev/null
}
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}
local max=${#changed}
[[ $max -lt ${#cached} ]] && max=${#cached}
{
emulate -L zsh
# return the type of the closest repository in the path hierarchy
{
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
local dir
while true; do
[ -d ${dir}.git ] && echo git && break
;;
*)
case "$repotype" in
;;
*)
case "$repotype" in
*) warn "$repotype repositories not (yet) supported in the prompt";;
esac
local MAXLEN MINLEN
*) warn "$repotype repositories not (yet) supported in the prompt";;
esac
local MAXLEN MINLEN
_update_vcs_prompt_vars_if_vcs_ran() {
local vcs="$(__vcs_get_repo_type)"
_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 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
esac
}
add-zsh-hook precmd _update_vcs_prompt_vars_if_vcs_ran
# now comes the working directory, composed from parts in $psvar,
# which is managed by $ZDOTDIR/zshrc/06-vcsprompt
# now comes the working directory, composed from parts in $psvar,
# which is managed by $ZDOTDIR/zshrc/06-vcsprompt
- echo -n '%1v%(2v.|%B%2v%b|.)%(3v .%3v.)'
+ echo -n '%1v%(2V.|%B%2v%b|.)%(3V .%3v.)'
- # and we finish with #/% for root/non-root, and a space
- echo -n '%# '
+ # and we finish with #/% for root/non-root, unless psvar[4] is set, and
+ # a space
+ echo -n "%(4V.%4v.%#) "
echo -n '%D{%d %H:%M:%S.%.}'
echo
}
echo -n '%D{%d %H:%M:%S.%.}'
echo
}
+typeset -g RPS1="$(make_rps1)"
unfunction make_rps1
# vim:ft=zsh
unfunction make_rps1
# vim:ft=zsh