Many terminal emulators (kitty, wezterm, etc.) now support so-called "shell integration" in which the shell prompt is modified to emit OSC escape codes that delimit the prompt and program output, and the terminal can use those to add search and navigation features to the UI.
In a Vim terminal I can imagine that this could be used (in normal mode) as a folding method, or with the location list, or with motion controls. For example, Vip might select the whole command output, { and } might jump between prompts.
Additionally, it can be used with something like autochdir to make vim aware of the current directory within the terminal session.
The other terminals mostly have built-in magic commands for inserting the escape codes into the prompts. Vim could choose to copy those (possibly literally) or just document the requirements for the user to set up.
What already works:
set foldmethod=marker.
┬─[ams@host:~]
╰─>$
I can use set foldmarker=╰─>$,┬─:g/^\$ /laddexpr line('.') . ':' . getline('.').zj and zk, assuming I already set up the markers.What doesn't work yet:
yip or Vip style commands for capturing whole output (unless folds allow this?).At the least, it would be nice to add some tips and tricks for what does work on the terminal help page. :)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I think I suggested something similar in #18343, at least in terms of making the builtin helptoc plugin use these sequences. It might be feasible to build some of the things your talking about as a "filetype plugin" for terminals; if so, that could be a good prototype from which to discuss possible directions?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
yes, that sounds like a good use for a plugin. Not necessarily something that belongs into Vim core right now.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I was not aware of HelpToc. I think I prefer the searchability of the location list, but it's nice to have. I can imagine lots of plugins could find uses for the OSC codes, if there was a way to get at them.
I do not have a clear view of what the "correct" implementation of the UI features would be. A filetype plugin sounds like it would work in the same way as the syntax colouring features work now? If so, I think that would be familiar to users and therefore a good choice. It would also allow for different shells, via different "filetypes"?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()