commit 9d05f702dfb983266b28be9ee125ef0e44bb0516 (patch)
parent 00fcfcdbdd07ed02018dcff5b22eb9cbd77d1cdb
Author: Alexander Karle <akarle@umass.edu>
Date: Sun, 18 Nov 2018 11:07:49 -0500
[bash] better newline after prompt
I was previously appending \n to the prompt, but this makes things
such as virtualenv act wonky (because they just append before the
newline).
Solution: set PROMPT_COMMAND environmental variable to be "echo"
(runs after each issuing of PS1)
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/bash/bash_prompt b/bash/bash_prompt
@@ -37,7 +37,7 @@ if tput setaf 1 &> /dev/null; then tput sgr0
BOLD="\[$(tput bold)\]"
RESET="\[$(tput sgr0)\]"
- export PS1="\n$BOLD$BLUE\w $RESET$GRAY${ssh_text}\$(parse_git_branch)"$'\n'"$BOLD$MAGENTA\$ $RESET"
+ export PS1="$BOLD$BLUE\w $RESET$GRAY${ssh_text}\$(parse_git_branch)"$'\n'"$BOLD$MAGENTA\$ $RESET"
export PS2="$ORANGE→ $RESET"
else
# TODO: write better case for too few colors...
@@ -49,3 +49,7 @@ else
export PS1="\w\n\$ "
export PS2="> "
fi
+
+# This command runs after each issuing of PS1
+# Used to add a newline after each prompt
+export PROMPT_COMMAND="echo"