1

Unsure what the best place to tackle this would be .bashrc? Using different shell? Some fancy terminal emulator?

Basically, I just want to keep seeing the command line / the last line of the terminal when I'm scrolling up in order to be able to more easily type while reading --help and stuff like that.

Comparable to: A sticky row in a spreadsheet editor, or the text field in most instant messaging apps, or the way an editor like nano keeps the list of keyboard shortcuts visible while you scroll the file, or the position: fixed property in css.

Possible solutions: A terminal emulator with a split view of the same bash session could work. Or a shell that handles scrolling in a way where it keeps the content of the last line the same.

sonofevil
  • 117
  • 1
    Something similar, using tmux+bash: here. Not perfect though. – Kamil Maciorowski Mar 26 '24 at 12:05
  • 1
    it would be a bit of a steep learning curve, but you can run emacs in a terminal (or have it create a new window), start a shell in that emacs, split the window and have 2 or more views of different parts of the shell session, in which you can scroll independently, and so type into the command line in one view, and scroll the other. – meuh Mar 26 '24 at 17:53

1 Answers1

1

You need both: 1) a special PS1= shell prompt and 2) a fancy terminal emulator.

Currently, I think the only terminal emulator that supports this on Linux is Visual Studio Code – enable terminal.integrated.stickyScroll.enabled in its settings. (It automatically injects the necessary prompt strings when you open a terminal window, so no manual .bashrc changes are needed.)

The underlying mechanism (the OSC 133 markers) actually comes from Final Term, but it's an abandoned project, and I'm not sure if it supported sticky scroll or if it only used the markers for a different purpose.

enter image description here

u1686_grawity
  • 452,512
  • Thanks. It's strange to use a whole coding suite just for a terminal emulator tho. Is there at least a way to launch directly into a terminal window? It's not listed in code-oss --help. – sonofevil Mar 26 '24 at 12:22
  • 1
    Apparently VSCode is the new Emacs. I don't know a hidden command-line option, but you can at least create a keyboard shortcut for workbench.action.createTerminalEditor. – u1686_grawity Mar 26 '24 at 12:28