Home Explore Blog CI



neovim

1st chunk of `runtime/doc/remote.txt`
09511f2cad8856013a3e08975603eff74125f3a843f2293100000001000009af
*remote.txt*    Nvim


		  VIM REFERENCE MANUAL    by Bram Moolenaar


Vim client-server communication				*client-server*

                                      Type |gO| to see the table of contents.

==============================================================================
1. Common functionality					*clientserver*

Nvim's |RPC| functionality allows clients to programmatically control Nvim. Nvim
itself takes command-line arguments that cause it to become a client to another
Nvim running as a server. These arguments match those provided by Vim's
clientserver option.

The following command line arguments are available:

    argument			meaning	~

   --remote [+{cmd}] {file} ...					*--remote*
				Open the file list in a remote Vim.  When
				there is no Vim server, execute locally.
				Vim allows one init command: +{cmd}.
				This must be an Ex command that can be
				followed by "|". It's not yet supported by
				Nvim.
				The rest of the command line is taken as the
				file list.  Thus any non-file arguments must
				come before this.
				You cannot edit stdin this way |--|.
				The remote Vim is raised.  If you don't want
				this use >
				 nvim --remote-send "<C-\><C-N>:n filename<CR>"
<
   --remote-silent [+{cmd}] {file} ...			*--remote-silent*
				As above, but don't complain if there is no
				server and the file is edited locally.
							*--remote-tab*
   --remote-tab			Like --remote but open each file in a new
				tabpage.
							*--remote-tab-silent*
   --remote-tab-silent		Like --remote-silent but open each file in a
				new tabpage.
								*--remote-send*
   --remote-send {keys}		Send {keys} to server and exit.  The {keys}
				are not mapped.  Special key names are
				recognized, e.g., "<CR>" results in a CR
				character.
								*--remote-expr*
   --remote-expr {expr}		Evaluate {expr} in server and print the result
				on stdout.
								*--remote-ui*
   --remote-ui			Display the UI of the server in the terminal.
				Fully interactive: keyboard and mouse input
				are forwarded to the server.
								*--server*
   --server {addr}		Connect to the named pipe or socket at the
				given address for executing remote commands.
				See |--listen| for specifying an address when
				starting a server.

Examples ~

Start an Nvim server listening on a named pipe at '~/.cache/nvim/server.pipe': >
    nvim --listen ~/.cache/nvim/server.pipe

Edit "file.txt" in an Nvim server listening at '~/.cache/nvim/server.pipe': >
    nvim

Title: Vim Client-Server Communication
Summary
This section describes how Nvim can communicate with other Nvim instances using a client-server model, leveraging Nvim's RPC functionality. It details the command-line arguments available for controlling a remote Nvim server, including options for opening files, sending keys, evaluating expressions, and displaying the server's UI. Examples are provided to demonstrate how to start a server and edit files in it.