summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-02-24 20:58:48 +0000
committerMike Frysinger <vapier@gentoo.org>2016-01-26 02:12:10 -0500
commitaa0fc40cbad85c69d35c94ebbd98a81be78123af (patch)
tree9b5b036fec5504d1d50ce66b2b0dc180ce9544b8 /app-shells
parentapp-shells/bash: introduce support for bashrc.d directory that is sourced in ... (diff)
downloadgentoo-aa0fc40cbad85c69d35c94ebbd98a81be78123af.tar.gz
gentoo-aa0fc40cbad85c69d35c94ebbd98a81be78123af.tar.bz2
gentoo-aa0fc40cbad85c69d35c94ebbd98a81be78123af.zip
app-shells/bashrc: Do window title setup through PS1 #223641 by michael@smith-li.com. Add history -a to PROMPT_COMMAND #517342 by Paweł Hajdan, Jr.. Add fix from upstream for variable declare weirdness.
Diffstat (limited to 'app-shells')
-rw-r--r--app-shells/bash/files/bashrc27
1 files changed, 20 insertions, 7 deletions
diff --git a/app-shells/bash/files/bashrc b/app-shells/bash/files/bashrc
index 300070974f54..6622b84eb71d 100644
--- a/app-shells/bash/files/bashrc
+++ b/app-shells/bash/files/bashrc
@@ -20,16 +20,29 @@ fi
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize
-# Enable history appending instead of overwriting. #139609
+# Disable completion when the input buffer is empty. i.e. Hitting tab
+# and waiting a long time for bash to expand all of $PATH.
+shopt -s no_empty_cmd_completion
+
+# Enable history appending instead of overwriting when exiting. #139609
shopt -s histappend
+# Save each command to the history file as it's executed. #517342
+# This does mean sessions get interleaved when reading later on, but this
+# way the history is always up to date. History is not synced across live
+# sessions though; that is what `history -n` does.
+PROMPT_COMMAND='history -a'
+
# Change the window title of X terminals
case ${TERM} in
xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|interix|konsole*)
- PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
+ PS1='\[\033]0;\u@\h:\w\007\]'
;;
screen*)
- PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\033\\"'
+ PS1='\[\033k\u@\h:\w\033\\\]'
+ ;;
+ *)
+ unset PS1
;;
esac
@@ -65,9 +78,9 @@ if ${use_color} ; then
fi
if [[ ${EUID} == 0 ]] ; then
- PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
+ PS1+='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
else
- PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
+ PS1+='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
fi
#BSD#@export CLICOLOR=1
@@ -78,9 +91,9 @@ if ${use_color} ; then
else
if [[ ${EUID} == 0 ]] ; then
# show root@ when we don't have colors
- PS1='\u@\h \W \$ '
+ PS1+='\u@\h \W \$ '
else
- PS1='\u@\h \w \$ '
+ PS1+='\u@\h \w \$ '
fi
fi