Skip to content

Commit ffe15eb

Browse files
committed
themes: use _save-and-reload-history()
First pass to use _Bash It_'s automatic history management.
1 parent f0690c0 commit ffe15eb

File tree

8 files changed

+17
-35
lines changed

8 files changed

+17
-35
lines changed

themes/codeword/codeword.theme.bash

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# shellcheck shell=bash
2+
13
SCM_THEME_PROMPT_PREFIX=${SCM_THEME_PROMPT_SUFFIX}
24
SCM_THEME_PROMPT_DIRTY="${bold_red}${normal}"
35
SCM_THEME_PROMPT_CLEAN="${bold_green}${normal}"
@@ -19,11 +21,5 @@ prompt() {
1921
PS1="$(user_host_path_prompt)$(virtualenv_prompt)$(scm_prompt) $(mark_prompt) "
2022
}
2123

22-
share_history() {
23-
history -a
24-
history -c
25-
history -r
26-
}
27-
28-
safe_append_prompt_command share_history
24+
safe_append_prompt_command '_save-and-reload-history 1'
2925
safe_append_prompt_command prompt

themes/doubletime/doubletime.theme.bash

100644100755
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
# shellcheck shell=bash
22

33
SCM_THEME_PROMPT_DIRTY=''
44
SCM_THEME_PROMPT_CLEAN=''
@@ -30,9 +30,7 @@ fi
3030

3131
function prompt_setter() {
3232
# Save history
33-
history -a
34-
history -c
35-
history -r
33+
_save-and-reload-history 1
3634
PS1="
3735
$(clock_prompt) $(scm_char) [${THEME_PROMPT_HOST_COLOR}\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)$(ruby_version_prompt)\w
3836
$(scm_prompt)$reset_color $ "

themes/doubletime_multiline/doubletime_multiline.theme.bash

100644100755
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
#!/usr/bin/env bash
1+
# shellcheck shell=bash
22

33
source "$BASH_IT/themes/doubletime/doubletime.theme.bash"
44

55
function prompt_setter() {
66
# Save history
7-
history -a
8-
history -c
9-
history -r
7+
_save-and-reload-history 1
108
PS1="
119
$(clock_prompt) $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)$(ruby_version_prompt)
1210
\w

themes/doubletime_multiline_pyonly/doubletime_multiline_pyonly.theme.bash

100644100755
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
#!/usr/bin/env bash
1+
# shellcheck shell=bash
22

33
source "$BASH_IT/themes/doubletime/doubletime.theme.bash"
44

55
function prompt_setter() {
66
# Save history
7-
history -a
8-
history -c
9-
history -r
7+
_save-and-reload-history 1
108
PS1="
119
$(clock_prompt) $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)
1210
\w

themes/nwinkler/nwinkler.theme.bash

100644100755
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
# shellcheck shell=bash
22

33
# Two line prompt showing the following information:
44
# (time) SCM [username@hostname] pwd (SCM branch SCM status)
@@ -29,9 +29,7 @@ prompt_setter() {
2929
else PROMPT_END=$PROMPT_END_DIRTY
3030
fi
3131
# Save history
32-
history -a
33-
history -c
34-
history -r
32+
_save-and-reload-history 1
3533
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) "
3634
PS2='> '
3735
PS4='+ '

themes/nwinkler_random_colors/nwinkler_random_colors.theme.bash

100644100755
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
# shellcheck shell=bash
22

33
# Two line prompt showing the following information:
44
# (time) SCM [username@hostname] pwd (SCM branch SCM status)
@@ -96,9 +96,7 @@ prompt_setter() {
9696
else PROMPT_END=$PROMPT_END_DIRTY
9797
fi
9898
# Save history
99-
history -a
100-
history -c
101-
history -r
99+
_save-and-reload-history 1
102100
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) "
103101
PS2='> '
104102
PS4='+ '

themes/pete/pete.theme.bash

100644100755
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
#!/usr/bin/env bash
1+
# shellcheck shell=bash
22

33
prompt_setter() {
44
# Save history
5-
history -a
6-
history -c
7-
history -r
5+
_save-and-reload-history 1
86
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 "
97
PS2='> '
108
PS4='+ '

themes/rainbowbrite/rainbowbrite.theme.bash

100644100755
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
# shellcheck shell=bash
22

33
# based off of n0qorg
44
# looks like, if you're in a git repo:
@@ -7,9 +7,7 @@
77

88
prompt_setter() {
99
# Save history
10-
history -a
11-
history -c
12-
history -r
10+
_save-and-reload-history 1
1311
# displays user@server in purple
1412
# PS1="$red$(scm_char) $purple\u@\h$reset_color:$blue\w$yellow$(scm_prompt_info)$(ruby_version_prompt) $black\$$reset_color "
1513
# no user@server

0 commit comments

Comments
 (0)