diff --git a/themes/base.theme.bash b/themes/base.theme.bash index a242a35e..430fb60d 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -499,3 +499,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 8b881d7e..5558e0eb 100644 --- a/themes/powerline-plain/powerline-plain.base.bash +++ b/themes/powerline-plain/powerline-plain.base.bash @@ -14,6 +14,8 @@ function __powerline_prompt_command { LEFT_PROMPT="" + _save-and-reload-history "${HISTORY_AUTOSAVE:-0}" + ## left prompt ## for segment in $POWERLINE_PROMPT; do local info="$(__powerline_${segment}_prompt)" diff --git a/themes/powerline-plain/powerline-plain.theme.bash b/themes/powerline-plain/powerline-plain.theme.bash index bddb6450..f9538c2a 100644 --- a/themes/powerline-plain/powerline-plain.theme.bash +++ b/themes/powerline-plain/powerline-plain.theme.bash @@ -54,5 +54,4 @@ HOST_THEME_PROMPT_COLOR=0 POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"} -safe_append_prompt_command __powerline_prompt_command - +safe_append_prompt_command __powerline_prompt_command \ No newline at end of file diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index 482b3464..377e6f8e 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -57,4 +57,6 @@ HOST_THEME_PROMPT_COLOR=0 POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"} +HISTORY_AUTOSAVE=${HISTORY_AUTOSAVE:-0} + safe_append_prompt_command __powerline_prompt_command