How to show surrounding commands?

Sometimes when looking for a past invocation of a command I also want to see a number of surrounding commands I ran at the same time, usually commands preceding the command I’m searching for to aid in setup.

For example, maybe I previously ran:

cd ~/example
export FOO='TmV2ZXIgZ29ubmEgZ2l2ZSB5b3UgdXAKTmV2ZXIgZ29ubmEgbGV0IHlvdSBkb3duCgo='
kubectl port-forward some-example-f5tl7cw 8080:8080
./do_things.sh 

I might remember that I ran do_things.sh and probably what directory I was in, but usually forget the other things preceding the running of the command.

Using ctrl-r/up-arrow is there a way to search for do_things.sh, find the relevant invocation and then see what I had run before it?

In my pre-Atuin ZSH setup, I would search for do_things.sh and on the relevant invocation press escape and I would be dumped at that position in history where I could then use the up/down arrows to scroll through commands surrounding that invocation.

It would be good if I could do similar in Atuin, but I’m struggling to find out if it is already possible - it would be absolutely brilliant if I could see this in the Atuin UI as if I’d just jumped to a point in the past.

1 Like