Merge pull request #1379 from leventyalcin/feature/save_history_immediately

add an env var that themes can save history immediately
pull/1394/head
Nils Winkler 2019-07-08 08:47:09 +02:00 committed by GitHub
commit 6329d3bdd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 2 deletions

View File

@ -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
}

View File

@ -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)"

View File

@ -55,4 +55,3 @@ HOST_THEME_PROMPT_COLOR=0
POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"}
safe_append_prompt_command __powerline_prompt_command

View File

@ -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