aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.markdown11
-rw-r--r--bash/bashrc.d/prompt.bash5
-rw-r--r--pdksh/pdkshrc.d/prompt.pdksh4
3 files changed, 11 insertions, 9 deletions
diff --git a/README.markdown b/README.markdown
index b8d9f89d..b6f259f2 100644
--- a/README.markdown
+++ b/README.markdown
@@ -133,21 +133,22 @@ defaults for interactive behavior.
A terminal session with my prompt looks something like this:
- tom@conan:~/.dotfiles(git:master+!)$ git status
+ tom@conan:~/.dotfiles(master+!)$ git status
M README.markdown
M bash/bashrc.d/prompt.bash
A init
- tom@conan:~/.dotfiles(git:master+!)$ foobar
+ tom@conan:~/.dotfiles(master+!)$ foobar
foobar: command not found
- tom@conan:~/.dotfiles(git:master+!)<127>$ sleep 5 &
+ tom@conan:~/.dotfiles(master+!)<127>$ sleep 5 &
[1] 28937
- tom@conan:~/.dotfiles(git:master+!){1}$
+ tom@conan:~/.dotfiles(master+!){1}$
It expands based on context to include these elements in this order:
* Whether in a Git repository if applicable, and punctuation to show whether
there are local modifications at a glance; Subversion support can also be
- enabled (I need it at work)
+ enabled (I need it at work), in which case a `git:` or `svn:` prefix is
+ added appropriately
* The number of running background jobs, if non-zero
* The exit status of the last command, if non-zero
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash
index 2a18c24c..23c89857 100644
--- a/bash/bashrc.d/prompt.bash
+++ b/bash/bashrc.d/prompt.bash
@@ -130,8 +130,9 @@ prompt() {
state=${state}^
fi
- # Print the status in brackets with a git: prefix
- printf '(git:%s%s)' "${branch:-unknown}" "$state"
+ # Print the status in brackets; add a git: prefix only if there
+ # might be another VCS prompt (because PROMPT_VCS is set)
+ printf '(%s%s%s)' "${PROMPT_VCS:+git:}" "${branch:-unknown}" "$state"
;;
# Subversion prompt function
diff --git a/pdksh/pdkshrc.d/prompt.pdksh b/pdksh/pdkshrc.d/prompt.pdksh
index 4f4986b6..f97c9096 100644
--- a/pdksh/pdkshrc.d/prompt.pdksh
+++ b/pdksh/pdkshrc.d/prompt.pdksh
@@ -111,8 +111,8 @@ prompt() {
state=${state}^
fi
- # Print the status in brackets with a git: prefix
- printf '(git:%s%s)' "${branch:-unknown}" "$state"
+ # Print the status in brackets; add a git: prefix only if there might be another VCS prompt (because PROMPT_VCS is set)
+ printf '(%s%s%s)' "${PROMPT_VCS:+git:}" "${branch:-unknown}" "$state"
;;
# Revert to simple inexpensive prompts