fix(keybindings): make sure we use the correct filtering fields

This commit is contained in:
Loric ANDRE 2026-03-23 23:19:10 +01:00
parent d40af611b6
commit c0a9be6b5f
2 changed files with 5 additions and 5 deletions

View file

@ -63,7 +63,7 @@ if [[ $- =~ i ]]; then
{ cmd = cmd "\n" $0 }
END { if (cmd != "" && !seen[cmd]++) printf "%s%d%s\t%s\0", c_idx, HISTCMD - idx, c_reset, cmd }
' |
SKIM_DEFAULT_OPTIONS="$SKIM_DEFAULT_OPTIONS -n2..,.. --bind=ctrl-r:toggle-sort $SKIM_CTRL_R_OPTS --no-multi --read0 $ansi_opt" $(__skimcmd) --query "$READLINE_LINE"
SKIM_DEFAULT_OPTIONS="$SKIM_DEFAULT_OPTIONS -n2.. --bind=ctrl-r:toggle-sort $SKIM_CTRL_R_OPTS --no-multi --read0 $ansi_opt" $(__skimcmd) --query "$READLINE_LINE"
) || return
echo -e "\033[0m"
READLINE_LINE=${output#*$'\t'}

View file

@ -137,7 +137,7 @@ skim-history-widget() {
ansi_opt='--ansi'
fi
local awk_filter='{ cmd=$0; sub(/^[ \t]*[0-9]+\**[ \t]+/, "", cmd); if (!seen[cmd]++) { idx=$1; sub(idx, c_idx idx c_reset); print } }'
local n=2 fc_opts=''
local n=3 fc_opts=''
if [[ -o extended_history ]]; then
local today=$(date +%Y-%m-%d)
# For today's commands, replace date ($2) with "today", otherwise remove time ($3).
@ -146,17 +146,17 @@ skim-history-widget() {
cmd = $0; sub(/^[ \t]*[0-9]+\**[ \t]+[^ \t]+[ \t]+[^ \t]+[ \t]+/, "", cmd)
if (!seen[cmd]++) {
time = $3; date = $2; idx = $1
if (date == today) sub(date " " time " ", c_date "today " time c_reset "\t")
if (date == today) sub(date " " time " ", c_date "today@" time c_reset "\t")
else sub(date " " time " ", c_date date c_reset "\t")
sub(idx, c_idx idx c_reset)
print
}
}'
fc_opts='-i'
n=3
n=4
fi
selected=( $(fc -rl $fc_opts 1 | awk -v c_idx="$c_idx" -v c_date="$c_date" -v c_reset="$c_reset" -v today="$today" "$awk_filter" |
SKIM_DEFAULT_OPTIONS="$SKIM_DEFAULT_OPTIONS -n$n..,.. --bind=ctrl-r:toggle-sort $SKIM_CTRL_R_OPTS --query=${(qqq)LBUFFER} --no-multi $ansi_opt --tabstop=20" $(__skimcmd)) )
SKIM_DEFAULT_OPTIONS="$SKIM_DEFAULT_OPTIONS -n$n.. --bind=ctrl-r:toggle-sort $SKIM_CTRL_R_OPTS --query=${(qqq)LBUFFER} --no-multi $ansi_opt --tabstop=20" $(__skimcmd)) )
local ret=$?
if [ -n "$selected" ]; then
num=$selected[1]