themes: use `_save-and-reload-history()`

First pass to use _Bash It_'s automatic history management.
pull/1941/head
John D Pell 2021-09-10 13:36:10 -07:00
parent f0690c09fb
commit ffe15ebfe0
8 changed files with 17 additions and 35 deletions

View File

@ -1,3 +1,5 @@
# shellcheck shell=bash
SCM_THEME_PROMPT_PREFIX=${SCM_THEME_PROMPT_SUFFIX}
SCM_THEME_PROMPT_DIRTY="${bold_red}${normal}"
SCM_THEME_PROMPT_CLEAN="${bold_green}${normal}"
@ -19,11 +21,5 @@ prompt() {
PS1="$(user_host_path_prompt)$(virtualenv_prompt)$(scm_prompt) $(mark_prompt) "
}
share_history() {
history -a
history -c
history -r
}
safe_append_prompt_command share_history
safe_append_prompt_command '_save-and-reload-history 1'
safe_append_prompt_command prompt

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
# shellcheck shell=bash
SCM_THEME_PROMPT_DIRTY=''
SCM_THEME_PROMPT_CLEAN=''
@ -30,9 +30,7 @@ fi
function prompt_setter() {
# Save history
history -a
history -c
history -r
_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 $ "

View File

@ -1,12 +1,10 @@
#!/usr/bin/env bash
# shellcheck shell=bash
source "$BASH_IT/themes/doubletime/doubletime.theme.bash"
function prompt_setter() {
# Save history
history -a
history -c
history -r
_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

View File

@ -1,12 +1,10 @@
#!/usr/bin/env bash
# shellcheck shell=bash
source "$BASH_IT/themes/doubletime/doubletime.theme.bash"
function prompt_setter() {
# Save history
history -a
history -c
history -r
_save-and-reload-history 1
PS1="
$(clock_prompt) $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)
\w

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
# shellcheck shell=bash
# Two line prompt showing the following information:
# (time) SCM [username@hostname] pwd (SCM branch SCM status)
@ -29,9 +29,7 @@ prompt_setter() {
else PROMPT_END=$PROMPT_END_DIRTY
fi
# Save history
history -a
history -c
history -r
_save-and-reload-history 1
PS1="($(clock_prompt)) $(scm_char) [${blue}\u${reset_color}@${green}\H${reset_color}] ${yellow}\w${reset_color}$(scm_prompt_info) ${reset_color}\n$(prompt_end) "
PS2='> '
PS4='+ '

View File

@ -1,4 +1,4 @@
#!/bin/bash
# shellcheck shell=bash
# Two line prompt showing the following information:
# (time) SCM [username@hostname] pwd (SCM branch SCM status)
@ -96,9 +96,7 @@ prompt_setter() {
else PROMPT_END=$PROMPT_END_DIRTY
fi
# Save history
history -a
history -c
history -r
_save-and-reload-history 1
PS1="($(clock_prompt)${reset_color}) $(scm_char) [${USERNAME_COLOR}\u${reset_color}@${HOSTNAME_COLOR}\H${reset_color}] ${PATH_COLOR}\w${reset_color}$(scm_prompt_info) ${reset_color}\n$(prompt_end) "
PS2='> '
PS4='+ '

6
themes/pete/pete.theme.bash 100644 → 100755
View File

@ -1,10 +1,8 @@
#!/usr/bin/env bash
# shellcheck shell=bash
prompt_setter() {
# Save history
history -a
history -c
history -r
_save-and-reload-history 1
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='+ '

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
# shellcheck shell=bash
# based off of n0qorg
# looks like, if you're in a git repo:
@ -7,9 +7,7 @@
prompt_setter() {
# Save history
history -a
history -c
history -r
_save-and-reload-history 1
# displays user@server in purple
# PS1="$red$(scm_char) $purple\u@\h$reset_color:$blue\w$yellow$(scm_prompt_info)$(ruby_version_prompt) $black\$$reset_color "
# no user@server