Problem: A Vim started by another program cannot talk to it over its
stdin and stdout the way a language server does; a script has
to make it connect to a socket instead.
Solution: Add the --stdio-channel argument and the "stdio" address for
ch_open(). Vim then serves the channel instead of reading Ex
commands and exits when it is closed. Stdin and stdout are
redirected to the null device so that other output cannot get
into the channel.
With --stdio-channel Vim can be the process at the other end of a channel:
it is started by another program and talks to it over its own stdin and
stdout, the way language servers and other tools do. Until now a Vim that
had to serve another process needed a socket, and a script to set up the
connection on both sides.
A language server for Vim script, written in Vim script. The server runs
in a Vim, so it can use getcompletion(), the help files and the user's
'runtimepath' to answer requests. Any editor whose LSP client speaks stdio
can start it with vim --stdio-channel -S server.vim; no client-side
support for sockets is needed.
Vim as a worker for Vim. A child Vim can be started with job_start() like
any other job and used in JSON mode, to run slow Vim script or a large
search and replace without blocking the editor, or to run code that may
crash without taking the editor down.
Embedding Vim in other programs. A Python or Node program can start a Vim
and drive it through the existing channel commands ("ex", "normal", "call",
"expr") in one session, instead of a temporary file and a new vim -es for
every step.
Testing. The state of a child Vim can be queried directly over the
channel, without a terminal or a Python test server in between.
The change reuses the existing channel code: the two file descriptors are
handed to channel_set_pipes() and the "lsp" and "json" modes work unchanged.
After the channel is opened the stdin and stdout of Vim point at the null
device, so messages from Vim and from commands it starts cannot corrupt the
protocol; stderr is left for error messages. Works on Unix and MS-Windows.
https://github.com/vim/vim/pull/21245
(8 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
thanks, can you please also update runtime/doc/vim.1?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
thanks, can you please also update
runtime/doc/vim.1?
Done.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
thanks
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()