theme/doubletime: adopt automatic history
Use `preexec` and `$HISTCONTROL` to configure _Bash It_'s automatic history management feature.pull/1951/head
parent
569b8b8c46
commit
db04b2b29f
|
|
@ -1,5 +1,17 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
case $HISTCONTROL in
|
||||
*'auto'*)
|
||||
: # Do nothing, already configured.
|
||||
;;
|
||||
*)
|
||||
# Append new history lines to history file
|
||||
HISTCONTROL="${HISTCONTROL:-}${HISTCONTROL:+:}autosave"
|
||||
;;
|
||||
esac
|
||||
safe_append_preexec '_bash-it-history-auto-load'
|
||||
safe_append_prompt_command '_bash-it-history-auto-save'
|
||||
|
||||
SCM_THEME_PROMPT_DIRTY=''
|
||||
SCM_THEME_PROMPT_CLEAN=''
|
||||
SCM_GIT_CHAR="${bold_cyan}±${normal}"
|
||||
|
|
@ -29,8 +41,6 @@ else
|
|||
fi
|
||||
|
||||
function prompt_setter() {
|
||||
# Save history
|
||||
_save-and-reload-history 1
|
||||
PS1="
|
||||
$(clock_prompt) $(scm_char) [${THEME_PROMPT_HOST_COLOR}\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)$(ruby_version_prompt)\w
|
||||
$(scm_prompt)$reset_color $ "
|
||||
|
|
|
|||
|
|
@ -2,9 +2,19 @@
|
|||
|
||||
source "$BASH_IT/themes/doubletime/doubletime.theme.bash"
|
||||
|
||||
case $HISTCONTROL in
|
||||
*'auto'*)
|
||||
: # Do nothing, already configured.
|
||||
;;
|
||||
*)
|
||||
# Append new history lines to history file
|
||||
HISTCONTROL="${HISTCONTROL:-}${HISTCONTROL:+:}autosave"
|
||||
;;
|
||||
esac
|
||||
safe_append_preexec '_bash-it-history-auto-load'
|
||||
safe_append_prompt_command '_bash-it-history-auto-save'
|
||||
|
||||
function prompt_setter() {
|
||||
# Save history
|
||||
_save-and-reload-history 1
|
||||
PS1="
|
||||
$(clock_prompt) $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)$(ruby_version_prompt)
|
||||
\w
|
||||
|
|
|
|||
|
|
@ -2,9 +2,19 @@
|
|||
|
||||
source "$BASH_IT/themes/doubletime/doubletime.theme.bash"
|
||||
|
||||
case $HISTCONTROL in
|
||||
*'auto'*)
|
||||
: # Do nothing, already configured.
|
||||
;;
|
||||
*)
|
||||
# Append new history lines to history file
|
||||
HISTCONTROL="${HISTCONTROL:-}${HISTCONTROL:+:}autosave"
|
||||
;;
|
||||
esac
|
||||
safe_append_preexec '_bash-it-history-auto-load'
|
||||
safe_append_prompt_command '_bash-it-history-auto-save'
|
||||
|
||||
function prompt_setter() {
|
||||
# Save history
|
||||
_save-and-reload-history 1
|
||||
PS1="
|
||||
$(clock_prompt) $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)
|
||||
\w
|
||||
|
|
|
|||
Loading…
Reference in New Issue