From 27f2baa4da065316f36c16cf06e96953ce3a3284 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Fri, 10 Jun 2016 16:24:39 -0700 Subject: [PATCH] handle powerline not existing --- dotfiles/lib/bash/prompt.sh | 2 -- dotfiles/lib/shellenv/functions.sh | 8 ++++++++ dotfiles/lib/zsh.sh | 5 +---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dotfiles/lib/bash/prompt.sh b/dotfiles/lib/bash/prompt.sh index e552b76a..65e0f759 100644 --- a/dotfiles/lib/bash/prompt.sh +++ b/dotfiles/lib/bash/prompt.sh @@ -78,5 +78,3 @@ esac function set_powerline_prompt { source "$(python_module_path powerline)/bindings/bash/powerline.sh" } - -set_powerline_prompt diff --git a/dotfiles/lib/shellenv/functions.sh b/dotfiles/lib/shellenv/functions.sh index 80243ab3..318deecf 100644 --- a/dotfiles/lib/shellenv/functions.sh +++ b/dotfiles/lib/shellenv/functions.sh @@ -421,3 +421,11 @@ function jump_cd { function source_if_exists { test -r "$1" && source "$1" } + +function python_module_exists { + python_module_path $@ 1>/dev/null 2>/dev/null +} + +function set_default_prompt { + python_module_exists powerline && set_powerline_prompt || set_my_prompt +} diff --git a/dotfiles/lib/zsh.sh b/dotfiles/lib/zsh.sh index 4be71222..d4b35566 100644 --- a/dotfiles/lib/zsh.sh +++ b/dotfiles/lib/zsh.sh @@ -10,9 +10,6 @@ unalias run-help 2> /dev/null 1>/dev/null autoload run-help HELPDIR=/usr/local/share/zsh/helpfiles - - - function if_emacs_zsh { if [ -z $(echo "$INSIDE_EMACS" | grep comint) ]; then set_my_prompt @@ -21,4 +18,4 @@ function if_emacs_zsh { fi } -environment_variable_exists INSIDE_EMACS && if_emacs_zsh || set_powerline_prompt +environment_variable_exists INSIDE_EMACS && if_emacs_zsh || set_default_prompt