tv bash-fzf-history: support unknown timestamps

This commit is contained in:
tv 2019-02-05 13:11:46 +01:00
parent 79267b99a0
commit 9d6875b02e

View File

@ -35,7 +35,12 @@ with import <stockholm/lib>;
__fzf_history__() (
IFS=$'\n'
result=( $(
# To add "unknown timestamps" to each line of the history:
# sed -i '/^#[0-9]/{n;b};s/^/#1\n/' "$HISTFILE"
HISTTIMEFORMAT=$'\e[38;5;244m%Y-%m-%dT%H:%M:%S\e[m ' history |
${pkgs.gnused}/bin/sed '
s/\(\x1b\[[0-9;]*\)244m1970-[0-9T:-]*/\1237m????-??-??T??:??:??/
' |
FZF_DEFAULT_OPTS="${toString [
/* sh */ "--ansi"
/* sh */ "--tac"