[UPDATE][SCRIPT] Use expansion for PROMPT_COMMAND
It seems like the idiomatic way to update $PROMPT_COMMAND is to use variable expansion to add a semi-colon and a space before the command we're adding. I also switched from prepending my commands to appending them, which allows overriding behaviour, such as terminal titles which could be set from system files.
This commit is contained in:
parent
173a0b093c
commit
2e927c89e7
|
@ -110,7 +110,7 @@ function __source_localrc_files() {
|
|||
# Execute this command every time
|
||||
if [ -n "$BASH_VERSION" ]; then
|
||||
[ -n "${DEBUG_LOCALRC+set}" ] && echo "Loaded Bash"
|
||||
PROMPT_COMMAND="__source_localrc_files; $PROMPT_COMMAND"
|
||||
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND; }__source_localrc_files"
|
||||
elif [ -n "$ZSH_VERSION" ]; then
|
||||
[ -n "${DEBUG_LOCALRC+set}" ] && echo "Loaded Zsh"
|
||||
precmd_functions+=( __source_localrc_files)
|
||||
|
|
|
@ -36,7 +36,7 @@ __term_title_prompt_command() {
|
|||
|
||||
case "$TERM" in
|
||||
xterm*|term_title*)
|
||||
[ -n "$BASH_VERSION" ] && PROMPT_COMMAND="__term_title_prompt_command;$PROMPT_COMMAND"
|
||||
[ -n "$BASH_VERSION" ] && PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND; }__term_title_prompt_command"
|
||||
[ -n "$ZSH_VERSION" ] && precmd_functions+=(__term_title_prompt_command)
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Reference in a new issue