aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.markdown4
-rw-r--r--bash/bashrc.d/prompt.bash8
2 files changed, 6 insertions, 6 deletions
diff --git a/README.markdown b/README.markdown
index c3e32d67..1a3dc016 100644
--- a/README.markdown
+++ b/README.markdown
@@ -83,14 +83,14 @@ My prompt generally looks like this, colored bright green:
It expands based on context to include these elements in this order:
-* The exit status of the last command, if it was non-zero
* Whether in a Git, Mercurial, or Subversion repository, and punctuation to
show whether there are local modifications at a glance
* The number of running background jobs
+* The exit status of the last command, if non-zero
With all of the above (a rare situation), it might look something like this:
- [user@hostname:~/gitrepo]<127>(git:master?){1}$
+ [user@hostname:~/gitrepo](git:master?){1}<127>$
This is all managed within the `prompt` function. Some of the Git stuff was
adapted from @necolas' [superb dotfiles][19].
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash
index 6d273185..a3baaa3b 100644
--- a/bash/bashrc.d/prompt.bash
+++ b/bash/bashrc.d/prompt.bash
@@ -2,17 +2,17 @@
prompt() {
# Variables for use only within this function
- local -i ret=$? colors=$(tput colors)
- local -a state=()
local color reset branch info url root
+ local -i colors=$(tput colors)
+ local -a state=()
# What's done next depends on the first argument to the function
case $1 in
# Turn complex, colored prompt on
on)
- PROMPT_COMMAND='history -a'
- PS1='\[\a\][\u@\h:\w]$(prompt ret)$(prompt vcs)$(prompt job)\$'
+ PROMPT_COMMAND='ret=$? ; history -a'
+ PS1='\[\a\][\u@\h:\w]$(prompt vcs)$(prompt job)$(prompt ret)\$'
# Check if we have non-bold bright green available
if ((colors > 8)); then