Describe the bug
Ctrl+R history search returns wrong results when extended_history is enabled. The query matches against the wrong fields instead of the actual command text.
Root cause
Commit c0a9be6 changed "today " to "today@", merging date and time into a single field. But it also bumped n from 3 to 4.
The awk filter transforms fc output from 4 fields into 3:
# Before awk (4 fields): index, date, time, command
12254 2026-03-29 15:58 ls -la /tmp
# After awk (3 fields): index, formatted_date, command
12254 today@15:58 ls -la /tmp
12254 2026-03-28 git status
With n=4, -n4.. tells sk to match on field 4 onwards, which is past the command. SK matches against nothing, returning random results.
To Reproduce
# n=4 (current, broken) — "ls" match is missing:
printf '\033[2m1\033[0m \033[32mtoday@15:58\033[0m\tls -la /tmp\n\033[2m2\033[0m \033[32mtoday@15:57\033[0m\tgit status\n' \
| sk -n4.. --ansi --filter "ls"
# n=3 (fixed) — correct result appears:
printf '\033[2m1\033[0m \033[32mtoday@15:58\033[0m\tls -la /tmp\n\033[2m2\033[0m \033[32mtoday@15:57\033[0m\tgit status\n' \
| sk -n3.. --ansi --filter "ls"
Expected behavior
History search should match against the command text.
Suggested fix
In shell/key-bindings.zsh:
The awk filter merges date+time into one field (today@HH:MM or YYYY-MM-DD), so the command is field 3, not 4.
Environment:
- OS: Darwin 25.3.0 arm64 (macOS)
skim version: sk 4.0.1
- Shell: zsh 5.9
Describe the bug
Ctrl+R history search returns wrong results when
extended_historyis enabled. The query matches against the wrong fields instead of the actual command text.Root cause
Commit
c0a9be6changed"today "to"today@", merging date and time into a single field. But it also bumpednfrom3to4.The awk filter transforms
fcoutput from 4 fields into 3:With
n=4,-n4..tells sk to match on field 4 onwards, which is past the command. SK matches against nothing, returning random results.To Reproduce
Expected behavior
History search should match against the command text.
Suggested fix
In
shell/key-bindings.zsh:The awk filter merges date+time into one field (
today@HH:MMorYYYY-MM-DD), so the command is field 3, not 4.Environment:
skimversion: sk 4.0.1