From 4ed0b279ef8372c12d69328afd4f9cd1702213c3 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 24 Sep 2023 07:18:57 +0300 Subject: 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 --- bashrc | 16 +++++++++------- 1 file 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" ] -- cgit v1.2.1