atuin icon indicating copy to clipboard operation
atuin copied to clipboard

feature request: show context on keypress

Open Astrantia opened this issue 2 years ago • 8 comments

one feature that I find missing in all projects is the lack of context discovery

forgetting the specific line I'm searching for happens to me frequently and rather I remember previous/next lines that followed the command I'm looking for. finding those lines and then revealing the context around those lines would help me find what I'm looking for.

if what I'm saying doesn't make sense, I'll explain it in more detail in the comments

Astrantia avatar Feb 10 '23 23:02 Astrantia

I think I get what you mean! You'd like to "inspect" a command to see what was ran before or after it?

I've been thinking about a "command inspector" for a while anyways, we just need a nice UX for it. It would be good to expose more of the info we store to the user

ellie avatar Feb 15 '23 09:02 ellie

There's a complication that I can forsee. In our search, we remove duplicates so you dont get a thousand matches for cargo run or ls 😅 but that means you might have duplicate contexts to see.

Now, a solution I can imagine is that when you find the command you're interested in, you enter an 'inspect mode' that brings up a new pane. It shows you the command history around the latest instance of that command and you get new keybindings shown to you that allow you to jump back and forward to the other instances of that command.

conradludgate avatar Feb 15 '23 09:02 conradludgate

Yeah 100%. It would need to be an inspector for the command, not just an instance of the command.

ellie avatar Feb 15 '23 09:02 ellie

I think I get what you mean! You'd like to "inspect" a command to see what was ran before or after it?

I've been thinking about a "command inspector" for a while anyways, we just need a nice UX for it. It would be good to expose more of the info we store to the user

that is what I meant exactly :) glad to see it's already under consideratoin

Astrantia avatar Feb 15 '23 10:02 Astrantia

I was about to open a feature request for this very same thing. I often forget the context for certain commands and this feature would be really useful. It doesn't matter that duplicate commands are filtered because its the same sequence of commands I execute every time.

Maybe a way to present this would be to have it as a filter so pressing Ctrl+R brings up a Context filter with a split pane where say, the top half, shows the context (commands before and after).

It would also be great to have a timestamp associated with the context

GrubbyHalo avatar Jan 22 '24 09:01 GrubbyHalo

how's this?

image

It's currently in main, and opened by ctrl-o on a item in the search results. I'd like to tweak it a bit and am definitely looking for feedback

Would be good to add:

  1. Explore many executions of the same command
  2. Explore sessions

ellie avatar Jan 22 '24 10:01 ellie

Wow. Its great you have an implementation already. I will definitely check out the latest and try it out.

However.. from the screenshot above, in my opinion, it looks a little too busy. The stats would be useless for me.. is it something that can be turned off ? Also i think it would be nice to have more than just one previous and next command.. I was thinking of a pane that had a list with the command highlighted and all entries before would be previous commands and all entries after would be commands after/next.

I will respond with feedback on https://forum.atuin.sh

GrubbyHalo avatar Jan 22 '24 11:01 GrubbyHalo

Hmm, I thought this iissue kinda needs «jump to found item» or something like that. So that you can find an item in history, and then drop search terms while remaining at selected point of history...

cab404 avatar Apr 19 '24 18:04 cab404