summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-09-24 07:18:57 +0300
committerLars Wirzenius <liw@liw.fi>2023-09-24 07:18:57 +0300
commit4ed0b279ef8372c12d69328afd4f9cd1702213c3 (patch)
treeb7b238ccecfaa1896727ab2505f5e83ad3bd368c
parent9e2cf325a896f000af51491c835ee339b9784547 (diff)
downloadliw-dot-files-4ed0b279ef8372c12d69328afd4f9cd1702213c3.tar.gz
fix(bashrc): setting of PROMPT_COMMAND
This is getting silly. I should just make sure I have zoxide and starship installed everywhere. Sponsored-by: author
-rw-r--r--bashrc16
1 files changed, 9 insertions, 7 deletions
diff --git a/bashrc b/bashrc
index 6bdf56a..9363dae 100644
--- a/bashrc
+++ b/bashrc
@@ -193,14 +193,16 @@ if [ -n "$PS1" ]; then
bind -r ''
fi
-export PROMPT_COMMAND=prompt_set_window_title
-
-if command -v zoxide > /dev/null; then
- eval "$(zoxide init bash)"
-fi
+gotcmd() {
+ command -v "$1" > /dev/null
+}
-if command -v starship > /dev/null; then
- eval "$(starship init bash)"
+if gotcmd zoxide && gotcmd starship; then
+ export PROMPT_COMMAND=prompt_set_window_title
+ eval "$(zoxide init bash)"
+ eval "$(starship init bash)"
+else
+ export PROMPT_COMMAND=prompt_command
fi
if [ -e "$HOME/.cargo/env" ]