diff --git a/lib/history.sh b/lib/history.sh index 18f6b56..90a4c96 100644 --- a/lib/history.sh +++ b/lib/history.sh @@ -39,11 +39,6 @@ HISTCONTROL="erasedups:ignoreboth" # Don't record some commands export HISTIGNORE="&:[ ]*:exit:ls:bg:fg:history:clear" -# Use standard ISO 8601 timestamp -# %F equivalent to %Y-%m-%d -# %T equivalent to %H:%M:%S (24-hours format) -HISTTIMEFORMAT='%F %T ' - # Enable incremental history search with up/down arrows (also Readline goodness) # Learn more about this here: http://codeinthehole.com/writing/the-most-important-command-line-tip-incremental-hi # bash4 specific ?? @@ -52,10 +47,16 @@ bind '"\e[B": history-search-forward' bind '"\e[C": forward-char' bind '"\e[D": backward-char' +# Use standard ISO 8601 timestamp +# %F equivalent to %Y-%m-%d +# %T equivalent to %H:%M:%S (24-hours format) + # Show history -#case $HIST_STAMPS in - #"mm/dd/yyyy") alias history='fc -fl 1' ;; - #"dd.mm.yyyy") alias history='fc -El 1' ;; - #"yyyy-mm-dd") alias history='fc -il 1' ;; - #*) alias history='fc -l 1' ;; -#esac +case $HIST_STAMPS in + "[mm/dd/yyyy]") HISTTIMEFORMAT=$'\033[31m[%m/%d/%Y] \033[36m[%T]\033[0m ' ;; + "[dd.mm.yyyy]") HISTTIMEFORMAT=$'\033[31m[%d.%m.%Y] \033[36m[%T]\033[0m ' ;; + "[yyyy-mm-dd]") HISTTIMEFORMAT=$'\033[31m[%F] \033[36m[%T]\033[0m ' ;; + "mm/dd/yyyy") HISTTIMEFORMAT='%m/%d/%Y %T ' ;; + "dd.mm.yyyy") HISTTIMEFORMAT='%d.%m.%Y %T ' ;; + "yyyy-mm-dd"|*) HISTTIMEFORMAT='%F %T ' ;; +esac diff --git a/templates/bashrc.osh-template b/templates/bashrc.osh-template index bf37195..7cdef11 100644 --- a/templates/bashrc.osh-template +++ b/templates/bashrc.osh-template @@ -42,9 +42,16 @@ OSH_THEME="font" # DISABLE_UNTRACKED_FILES_DIRTY="true" # Uncomment the following line if you want to change the command execution time -# stamp shown in the history command output. -# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" -# HIST_STAMPS="mm/dd/yyyy" +# stamp shown in the history command output. One of the following values can +# be used to specify the timestamp format. +# * 'mm/dd/yyyy' # mm/dd/yyyy + time +# * 'dd.mm.yyyy' # dd.mm.yyyy + time +# * 'yyyy-mm-dd' # yyyy-mm-dd + time +# * '[mm/dd/yyyy]' # [mm/dd/yyyy] + [time] with colors +# * '[dd.mm.yyyy]' # [dd.mm.yyyy] + [time] with colors +# * '[yyyy-mm-dd]' # [yyyy-mm-dd] + [time] with colors +# If not set, the default value is 'yyyy-mm-dd'. +# HIST_STAMPS='yyyy-mm-dd' # Uncomment the following line if you do not want OMB to overwrite the existing # aliases by the default OMB aliases defined in lib/*.sh