From e93cc67bcd3dd527f733c0eac4da64c7b5cb0110 Mon Sep 17 00:00:00 2001 From: Levent Yalcin Date: Mon, 10 Jun 2019 13:39:35 +0100 Subject: [PATCH] added a function instead running the same check and commands in every theme --- themes/base.theme.bash | 5 +++++ themes/powerline-plain/powerline-plain.base.bash | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 2761b632..c58aca82 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -497,3 +497,8 @@ function safe_append_prompt_command { fi fi } + +function _save-and-reload-history() { + local autosave=${1:-0} + [[ $autosave -eq 1 ]] && history -a && history -c && history -r +} \ No newline at end of file diff --git a/themes/powerline-plain/powerline-plain.base.bash b/themes/powerline-plain/powerline-plain.base.bash index 239ed3ea..5558e0eb 100644 --- a/themes/powerline-plain/powerline-plain.base.bash +++ b/themes/powerline-plain/powerline-plain.base.bash @@ -14,7 +14,7 @@ function __powerline_prompt_command { LEFT_PROMPT="" - [[ $HISTORY_AUTOSAVE -eq 1 ]] && history -a && history -c && history -r + _save-and-reload-history "${HISTORY_AUTOSAVE:-0}" ## left prompt ## for segment in $POWERLINE_PROMPT; do