theme/pete: adopt automatic history
Use `preexec` and `$HISTCONTROL` to configure _Bash It_'s automatic history management feature.pull/1951/head
parent
24a4067cb3
commit
7823e36d15
|
|
@ -7,12 +7,20 @@ function prompt_setter() {
|
|||
scm_char="$(scm_char)"
|
||||
scm_prompt_info="$(scm_prompt_info)"
|
||||
ruby_version_prompt="$(ruby_version_prompt)"
|
||||
_save-and-reload-history 1 # Save history
|
||||
PS1="(${clock_prompt}) ${scm_char} [${blue?}\u${reset_color?}@${green?}\H${reset_color?}] ${yellow?}\w${reset_color?}${scm_prompt_info}${ruby_version_prompt} ${reset_color?} "
|
||||
PS2='> '
|
||||
PS4='+ '
|
||||
}
|
||||
|
||||
case $HISTCONTROL in
|
||||
*'auto'*)
|
||||
: # Do nothing, already configured.
|
||||
;;
|
||||
*)
|
||||
# Append new history lines to history file
|
||||
HISTCONTROL="${HISTCONTROL:-}${HISTCONTROL:+:}autosave"
|
||||
;;
|
||||
esac
|
||||
safe_append_prompt_command prompt_setter
|
||||
|
||||
SCM_THEME_PROMPT_DIRTY=" ✗"
|
||||
|
|
|
|||
Loading…
Reference in New Issue