Merge pull request #1379 from leventyalcin/feature/save_history_immediately
add an env var that themes can save history immediately
This commit is contained in:
@@ -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
|
||||
}
|
||||
@@ -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)"
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user