Merge pull request #1379 from leventyalcin/feature/save_history_immediately
add an env var that themes can save history immediatelypull/1394/head
commit
6329d3bdd2
|
|
@ -499,3 +499,8 @@ function safe_append_prompt_command {
|
||||||
fi
|
fi
|
||||||
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=""
|
LEFT_PROMPT=""
|
||||||
|
|
||||||
|
_save-and-reload-history "${HISTORY_AUTOSAVE:-0}"
|
||||||
|
|
||||||
## left prompt ##
|
## left prompt ##
|
||||||
for segment in $POWERLINE_PROMPT; do
|
for segment in $POWERLINE_PROMPT; do
|
||||||
local info="$(__powerline_${segment}_prompt)"
|
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"}
|
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"}
|
POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"}
|
||||||
|
|
||||||
|
HISTORY_AUTOSAVE=${HISTORY_AUTOSAVE:-0}
|
||||||
|
|
||||||
safe_append_prompt_command __powerline_prompt_command
|
safe_append_prompt_command __powerline_prompt_command
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue