A thing I’ve only just realised about #less:
When you press ‘/‘ to search forward, or ‘?’ to search backward, and enter a regex, two changes of state occur:
- The regex is remembered, so that ‘n’ or ‘N’ will search for the same thing again.
- The direction is remembered, so that ‘n’ searches in the same direction again, and ‘N’ searches in the opposite direction.
I’ve only just noticed that #2 happens at the instant of pressing / or ?, not at the instant of pressing Return. Because it takes effect even if you change your mind and cancel the attempt to input a new search regex:
• enter “?foo”, which searches backward for /foo/ • press ‘n’, which searches backward for /foo/ again • press ‘/‘, which prompts for a forward-search string • press Backspace, which cancels that prompt • now pressing ‘n’ searches forward for /foo/
I think this must be why I sometimes get confused about which direction I’m searching in. But also, wow, it’s taken me decades to notice. I think it must be because when I start and then cancel a prompt like that, I don’t consciously remember doing it at all – I expected so strongly that it would be a no-op that I forget it immediately!