Merge pull request #1979 from gaelicWizard/preexec-histcontrol
preexec: work around upstream mangling of `$HISTCONTROL`pull/1984/head
commit
ab3b8b8f22
|
|
@ -155,6 +155,3 @@ if ! _command_exists reload && [[ -n "${BASH_IT_RELOAD_LEGACY:-}" ]]; then
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Disable trap DEBUG on subshells - https://github.com/Bash-it/bash-it/pull/1040
|
|
||||||
set +T
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,11 @@ precmd_xterm_title() {
|
||||||
}
|
}
|
||||||
|
|
||||||
preexec_xterm_title() {
|
preexec_xterm_title() {
|
||||||
set_xterm_title "$(_short-command "${1:-}") {$(_short-dirname)} (${SHORT_USER:-${USER}}@${SHORT_HOSTNAME:-${HOSTNAME}})"
|
local command_line="${BASH_COMMAND:-${1:-}}"
|
||||||
|
local directory_name short_command
|
||||||
|
directory_name="$(_short-dirname)"
|
||||||
|
short_command="$(_short-command "${command_line}")"
|
||||||
|
set_xterm_title "${short_command} {${directory_name}} (${SHORT_USER:-${USER}}@${SHORT_HOSTNAME:-${HOSTNAME}})"
|
||||||
}
|
}
|
||||||
|
|
||||||
case "${TERM:-dumb}" in
|
case "${TERM:-dumb}" in
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,25 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# shellcheck disable=1090
|
# shellcheck disable=SC2034
|
||||||
source "${BASH_IT}"/vendor/github.com/rcaloras/bash-preexec/bash-preexec.sh
|
#
|
||||||
|
# Load the `bash-preexec.sh` library, and define helper functions
|
||||||
|
|
||||||
|
## Prepare, load, fix, and install `bash-preexec.sh`
|
||||||
|
|
||||||
|
# Disable immediate `$PROMPT_COMMAND` modification
|
||||||
|
__bp_delay_install="delayed"
|
||||||
|
|
||||||
|
# shellcheck source-path=SCRIPTDIR/../github.com/rcaloras/bash-preexec
|
||||||
|
source "${BASH_IT?}/vendor/github.com/rcaloras/bash-preexec/bash-preexec.sh"
|
||||||
|
|
||||||
|
# Block damanaging user's `$HISTCONTROL`
|
||||||
|
function __bp_adjust_histcontrol() { :; }
|
||||||
|
|
||||||
|
# Don't fail on readonly variables
|
||||||
|
function __bp_require_not_readonly() { :; }
|
||||||
|
|
||||||
|
# Disable trap DEBUG on subshells - https://github.com/Bash-it/bash-it/pull/1040
|
||||||
|
__bp_enable_subshells= # blank
|
||||||
|
set +T
|
||||||
|
|
||||||
|
# Modify `$PROMPT_COMMAND` now
|
||||||
|
__bp_install_after_session_init
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue