terminator icon indicating copy to clipboard operation
terminator copied to clipboard

Scroll to last executed command

Open mp3guy opened this issue 4 years ago • 7 comments

Sometimes when I run commands that output a lot, I find it difficult to scroll to the top of that output and find where in the scroll back I executed the last command. Is there a way of jumping to the scrollback line where the last command was executed?

mp3guy avatar May 11 '20 12:05 mp3guy

Unfortunately, the terminal itself has no way of differentiating a prompt from any other text that is on the terminal. Terminal and iterm2 on OSX have a way of marking prompts, and then being able to jump to the previous mark. This is a neat feature that I just discovered, and, oddly enough, I don't think any other linux terminal is able to do this. There may be a technical reason for this, but I may also poke around the iterm2 source code to see if I can code up something similar.

One hack to achieve this would be to do Ctrl-Shift-f and search for your prompt, and this will find your last prompt.

mattrose avatar May 12 '20 01:05 mattrose

Even just a feature where it can move the scroll bar back to the line you were at when you last pressed Enter would do the trick. I'd thought about the Ctrl-Shift-f option but was really looking for a single keypress option.

mp3guy avatar May 12 '20 08:05 mp3guy

Following prompts will only work when there is some kind of marker. Remembering the scroll position might be tricky...

lazyfrosch avatar May 12 '20 20:05 lazyfrosch

See also https://bugzilla.gnome.org/show_bug.cgi?id=767230.

egmontkob avatar May 13 '20 13:05 egmontkob

VTE 0.76 will support this, with the hardcoded Shift+Ctrl+Left/Right keys, using the quasi-standard OSC 133 escape sequences (the prompt is set up in vte.sh to emit these).

egmontkob avatar Feb 10 '24 22:02 egmontkob

However, Terminator hijacks the Shift+Ctrl+Left/Right (and also Up/Down) keypresses, so this functionality (as well as scrolling by lines) is not available.

Ideally VTE should make these shortcuts configurable, but I'm not sure it's going to happen any time soon. Maybe Terminator should reconsider its own shortcuts. Until then, users can reconfigure Terminator's ones in its settings.

egmontkob avatar Feb 11 '24 09:02 egmontkob

I just switched to kitty terminal instead

mp3guy avatar Feb 11 '24 12:02 mp3guy