pull/1951/merge
John D Pell 2022-04-03 09:25:31 -04:00 committed by GitHub
commit cb7aa5e615
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 128 additions and 21 deletions

View File

@ -41,6 +41,16 @@ SCM_THEME_BRANCH_TRACK_PREFIX="${normal} ⤏ ${cyan}"
SCM_THEME_CURRENT_USER_PREFFIX='  '
SCM_GIT_SHOW_CURRENT_USER=false
case $HISTCONTROL in
*'auto'*)
: # Do nothing, already configured.
;;
*)
# Append new history lines to history file
HISTCONTROL="${HISTCONTROL:-}${HISTCONTROL:+:}autosave"
;;
esac
function _git-uptream-remote-logo {
[[ "$(_git-upstream)" == "" ]] && SCM_GIT_CHAR="$SCM_GIT_CHAR_DEFAULT"
@ -80,8 +90,6 @@ function _prompt {
_exit-code exit_code
_git-uptream-remote-logo
history -a
# Detect root shell
if [ "$(whoami)" = root ]; then
dir_color=$red
@ -109,4 +117,5 @@ function _prompt {
PS1="${PS1}${wrap_char}${normal} "
}
safe_append_preexec _bash-it-history-auto-save
safe_append_prompt_command _prompt

View File

@ -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_PREFIX="${SCM_THEME_PROMPT_SUFFIX:-}"
SCM_THEME_PROMPT_DIRTY="${bold_red?}${normal?}"
SCM_THEME_PROMPT_CLEAN="${bold_green?}${normal?}"
@ -21,5 +33,4 @@ function prompt() {
PS1="$(user_host_path_prompt)$(virtualenv_prompt)$(scm_prompt) $(mark_prompt) "
}
safe_append_prompt_command '_save-and-reload-history 1'
safe_append_prompt_command prompt

View File

@ -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 $ "

View File

@ -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

View File

@ -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

View File

@ -41,6 +41,16 @@ USER_HOST_THEME_PROMPT_SUFFIX=" "
VIRTUALENV_THEME_PROMPT_PREFIX='('
VIRTUALENV_THEME_PROMPT_SUFFIX=') '
case $HISTCONTROL in
*'auto'*)
: # Do nothing, already configured.
;;
*)
# Append new history lines to history file
HISTCONTROL="${HISTCONTROL:-}${HISTCONTROL:+:}autosave"
;;
esac
function prompt_command() {
# This needs to be first to save last command return code
local RC="$?"
@ -55,10 +65,8 @@ function prompt_command() {
ret_status="${bold_red}"
fi
# Append new history lines to history file
history -a
PS1="$(clock_prompt)${virtualenv}$(user_host_prompt)${bold_cyan}\W $(scm_prompt_char_info)${ret_status}${normal}"
}
save_append_preexec _bash-it-history-auto-save
safe_append_prompt_command prompt_command

View File

@ -16,6 +16,18 @@
# since 'fasd' is messing with the $PROMPT_COMMAND
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'
PROMPT_END_CLEAN="${green}${reset_color}"
PROMPT_END_DIRTY="${red}${reset_color}"
@ -28,8 +40,6 @@ prompt_setter() {
if [[ $exit_status -eq 0 ]]; then PROMPT_END=$PROMPT_END_CLEAN
else PROMPT_END=$PROMPT_END_DIRTY
fi
# Save history
_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

@ -95,13 +95,23 @@ prompt_setter() {
if [[ $exit_status -eq 0 ]]; then PROMPT_END=$PROMPT_END_CLEAN
else PROMPT_END=$PROMPT_END_DIRTY
fi
# Save history
_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='+ '
}
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'
safe_append_prompt_command prompt_setter
SCM_THEME_PROMPT_DIRTY=" ${bold_red}${normal}"

View File

@ -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=" ✗"

View File

@ -1,5 +1,18 @@
# shellcheck shell=bash
. "$BASH_IT/themes/powerline/powerline.base.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 __powerline_left_segment {
local OLD_IFS="${IFS}"; IFS="|"
local params=( $1 )
@ -34,8 +47,6 @@ function __powerline_prompt_command {
LAST_SEGMENT_COLOR=""
PROMPT_AFTER="${POWERLINE_PROMPT_AFTER}"
_save-and-reload-history "${HISTORY_AUTOSAVE:-0}"
## left prompt ##
for segment in $POWERLINE_PROMPT; do
local info="$(__powerline_${segment}_prompt)"

View File

@ -5,9 +5,19 @@
# ± ~/path/to (branch ✓) $
# in glorious red / blue / yellow color scheme
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'
prompt_setter() {
# Save history
_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