Wednesday, April 12, 2023

Re: Save terminal buffer with colors?

> Is there any possibility to save the content of terminal buffer (to a file)
> with colors? I have terminal buffers with thousands of lines in scrollback
> and I need to save it for further reference. If I just yank the lines and
> paste into a normal buffer then all coloring is lost. Also the TOhtml
> plugin gives the text without colors.
>
> Some programs output error messages in red color and so they are standing
> out and are easily spotted when scanning the terminal scrollback. For
> comparison: It's possible to copy the scrollback of gnome terminal as HTML
> and save it into file. Then later it's easy to open that file in a browser
> and read the lines with original colors. Search some info in it. Having
> something similar in vim terminal would be nice.

I don't think this is currently possible for scrollback. You can get
the visible text and attributes with term_scrape(). That can be used to
store the information somewhere, it should be possible to make a plugin
that outputs HTML.

It should not be difficult to make term_scrape() work for text that has
scrolled out of view. I wonder how to indicate the line number, perhaps
with a negative number? Thus -1 would be the line above the first
visible line. Using an absolute number is made difficult by the
'termwinscroll' value, lines at the start may have been deleted.

--
Vi beats Emacs to death, and then again!
http://linuxtoday.com/stories/5764.html

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20230412103352.D792F1C10CC%40moolenaar.net.

No comments:

Post a Comment