theme/powerline-plain: adopt automatic history
Use `preexec` and `$HISTCONTROL` to configure _Bash It_'s automatic history management feature.pull/1951/head
parent
8a3cc89bf2
commit
24a4067cb3
|
|
@ -1,5 +1,18 @@
|
||||||
|
# shellcheck shell=bash
|
||||||
. "$BASH_IT/themes/powerline/powerline.base.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 {
|
function __powerline_left_segment {
|
||||||
local OLD_IFS="${IFS}"; IFS="|"
|
local OLD_IFS="${IFS}"; IFS="|"
|
||||||
local params=( $1 )
|
local params=( $1 )
|
||||||
|
|
@ -34,8 +47,6 @@ function __powerline_prompt_command {
|
||||||
LAST_SEGMENT_COLOR=""
|
LAST_SEGMENT_COLOR=""
|
||||||
PROMPT_AFTER="${POWERLINE_PROMPT_AFTER}"
|
PROMPT_AFTER="${POWERLINE_PROMPT_AFTER}"
|
||||||
|
|
||||||
_save-and-reload-history "${HISTORY_AUTOSAVE:-0}"
|
|
||||||
|
|
||||||
## left prompt ##
|
## left prompt ##
|
||||||
for segment in $POWERLINE_PROMPT; do
|
for segment in $POWERLINE_PROMPT; do
|
||||||
local info="$(__powerline_${segment}_prompt)"
|
local info="$(__powerline_${segment}_prompt)"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue