X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=.bashrc;h=14eeaec3b31bc792485a9d2d22d7137ce7c70704;hb=e2dd4852fbee0fd13b4c20197acefee175f1cdc9;hp=4f3d23ee8c68c32a1e80a900534d17b4dc7c31f0;hpb=e8e2e9e16b950a1f3ac92a5417dcaaf5ea331d94;p=dotfiles.git diff --git a/.bashrc b/.bashrc index 4f3d23e..14eeaec 100644 --- a/.bashrc +++ b/.bashrc @@ -25,6 +25,12 @@ esac . "$HOME"/.shellrc +if [ "$HISTFILE" = "$HOME/.bash_history" ]; then + # This is the default value set by interactive bash + # when the global value was unset. Unset it here too. + unset HISTFILE +fi + # append to the history file, don't overwrite it shopt -s histappend @@ -295,3 +301,22 @@ if test -x /usr/bin/git >/dev/null 2>&1; then complete -F _git_open_remote git-open-remote fi + + +if [ "$SHLVL" -eq 1 -a "`type -t X`" = function ] && which startx >/dev/null 2>&1; then + # From https://stackoverflow.com/a/18839557 + + copy_function() { + test -n "$(declare -f "$1")" || return + eval "${_/$1/$2}" + } + + rename_function() { + copy_function "$@" || return + unset -f "$1" + } + + rename_function X _non_bash_X + + X() { history -a; _non_bash_X; history -r; } +fi