Skip to content

ability to pipe scrollback buffer to a pager or terminal editor like kitty #7749

@chiefjester

Description

@chiefjester

Ability to pipe scrollback buffer to a pager or terminal editor

This is basically what kitty does with ctrl-shift-h. By default it just uses less, but you can use any pager or terminal editor just as long as it understands ANSI escape codes. eg scrollback_pager nvim -c 'set ft=man' -.

I believe this is a more powerful way to mark, select, copy than introducing mark mode (#5804) and selection spec (#2840). Because it leverages all the features a terminal editor has as oppose to have arbitrary bindings that only exist in Microsoft Terminal.

Don't get me wrong, while I know I just said that this is more powerful, I'm not saying this could replace, but rather be a powerful complement to those PRs.

I guess the right approach is just dumping the whole buffer to stdin and piping it to whatever command we set in JSON configuration.

With Microsoft Terminal already supporting splits and tabs, this could totally replace tmux for me. And I do think this is a superior approach since terminal multiplexers tend to just duplicate all the escape sequences you type, which is wasteful. Having the Terminal handle your splits, and scrollback buffer is what most people use terminal multiplexer is for.

Some might say, "but what about sessions?". Tmux is an odd program since it is both a session manager and a terminal multiplexer. This solves the latter by completing the trifecta - splits, tabs, scrollback buffer.

This should complement the history size configuration. Since having a large amount of scrollback buffer could lead to slowdowns. But using vim for years, I never found a file that it couldn't handle, (I'm talking about opening gigabytes worth of log files).

Proposed technical implementation details (optional)

  1. Default binding: ctrl-shift-h
  2. Pipes the whole buffer to stdin to a default program like less
    2a. (optional) We could remove all the ANSI Escape codes by default, that way you just pipe it directly to your terminal like vim -M +MANPAGER -, I have to use sed to remove them when using it in kitty.
  3. Ability to change the scrollback pager program via scrollbackPager in JSON Config.
  4. closing the scrollback pager would bring you back to where you invoked to command

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-ExtensibilityA feature that would ideally be fulfilled by us having an extension model.Issue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Product-TerminalThe new Windows Terminal.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions