/usr/share/doc/vim/html/remote.html is in vim-doc 2:8.0.1453-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | <HTML>
<HEAD>
<META HTTP-EQUIV="Content-type" content="text/html; charset=ISO-8859-1">
<TITLE>Vim documentation: remote</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>Vim documentation: remote</H1>
<A NAME="top"></A>
<A HREF="index.html">main help file</A>
<HR>
<PRE>
*<A NAME="remote.txt"></A><B>remote.txt</B>* For Vim version 8.0. Last change: 2017 Nov 12
VIM REFERENCE MANUAL by <A HREF="intro.html#Bram">Bram</A> <A HREF="intro.html#Moolenaar">Moolenaar</A>
Vim <A HREF="#client-server">client-server</A> communication *<A NAME="client-server"></A><B>client-server</B>*
1. Common functionality |<A HREF="#clientserver">clientserver</A>|
2. <A HREF="options.html#X11">X11</A> specific items |<A HREF="#x11-clientserver">x11-clientserver</A>|
3. <A HREF="os_win32.html#MS-Windows">MS-Windows</A> specific items |<A HREF="#w32-clientserver">w32-clientserver</A>|
{Vi does not have any of these commands}
==============================================================================
1. Common functionality *<A NAME="clientserver"></A><B>clientserver</B>*
When compiled with the |<A HREF="various.html#+clientserver">+clientserver</A>| option, Vim can act <A HREF="motion.html#as">as</A> a command
server. It accepts <A HREF="message.html#messages">messages</A> from a client and executes them. At the same
time, Vim can function <A HREF="motion.html#as">as</A> a client and send commands to a Vim server.
The following command line arguments are available:
<B><FONT COLOR="PURPLE"> argument meaning </FONT></B>
<A HREF="#--remote">--remote</A> [+{cmd}] <A HREF="editing.html#{file}">{file}</A> <A HREF="eval.html#...">...</A> *<A NAME="--remote"></A><B>--remote</B>*
Open the file <A HREF="eval.html#list">list</A> in a remote Vim. When
there is no Vim server, execute locally.
There is one optional init command: +{cmd}.
This must be an <A HREF="intro.html#Ex">Ex</A> command that can be
followed by "|".
The rest of the command line is taken <A HREF="motion.html#as">as</A> the
file <A HREF="eval.html#list">list</A>. Thus any non-file arguments must
come before this.
You cannot edit stdin this way |<A HREF="starting.html#--">--</A>|.
The remote Vim is raised. If you don't want
this use
<B> vim --remote-send "<C-\><C-N>:n filename<CR>"</B>
<A HREF="#--remote-silent">--remote-silent</A> [+{cmd}] <A HREF="editing.html#{file}">{file}</A> <A HREF="eval.html#...">...</A> *<A NAME="--remote-silent"></A><B>--remote-silent</B>*
As above, but don't complain if there is no
server and the file is edited locally.
<A HREF="#--remote-wait">--remote-wait</A> [+{cmd}] <A HREF="editing.html#{file}">{file}</A> <A HREF="eval.html#...">...</A> *<A NAME="--remote-wait"></A><B>--remote-wait</B>*
As <A HREF="#--remote">--remote</A>, but wait for files to complete
(unload) in remote Vim.
<A HREF="#--remote-wait-silent">--remote-wait-silent</A> [+{cmd}] <A HREF="editing.html#{file}">{file}</A> <A HREF="eval.html#...">...</A> *<A NAME="--remote-wait-silent"></A><B>--remote-wait-silent</B>*
As <A HREF="#--remote-wait">--remote-wait</A>, but don't complain if there
is no server.
*<A NAME="--remote-tab"></A><B>--remote-tab</B>*
<A HREF="#--remote-tab">--remote-tab</A> Like <A HREF="#--remote">--remote</A> but open each file in a new
<A HREF="tabpage.html#tabpage">tabpage</A>.
*<A NAME="--remote-tab-silent"></A><B>--remote-tab-silent</B>*
<A HREF="#--remote-tab-silent">--remote-tab-silent</A> Like <A HREF="#--remote-silent">--remote-silent</A> but open each file in a
new <A HREF="tabpage.html#tabpage">tabpage</A>.
*<A NAME="--remote-tab-wait"></A><B>--remote-tab-wait</B>*
<A HREF="#--remote-tab-wait">--remote-tab-wait</A> Like <A HREF="#--remote-wait">--remote-wait</A> but open each file in a new
<A HREF="tabpage.html#tabpage">tabpage</A>.
*<A NAME="--remote-tab-wait-silent"></A><B>--remote-tab-wait-silent</B>*
<A HREF="#--remote-tab-wait-silent">--remote-tab-wait-silent</A> Like <A HREF="#--remote-wait-silent">--remote-wait-silent</A> but open each file
in a new <A HREF="tabpage.html#tabpage">tabpage</A>.
*<A NAME="--servername"></A><B>--servername</B>*
<A HREF="#--servername">--servername</A> {name} Become the server {name}. When used together
with one of the <A HREF="#--remote">--remote</A> commands: connect to
server {name} instead of the default (see
below).
*<A NAME="--remote-send"></A><B>--remote-send</B>*
<A HREF="#--remote-send">--remote-send</A> {keys} Send {keys} to server and exit. The {keys}
are not mapped. <A HREF="eval.html#Special">Special</A> key names are
recognized, e.g., "<A HREF="motion.html#<CR>"><CR></A>" results in a CR
character.
*<A NAME="--remote-expr"></A><B>--remote-expr</B>*
<A HREF="#--remote-expr">--remote-expr</A> {expr} Evaluate {expr} in server and print the result
on stdout.
*<A NAME="--serverlist"></A><B>--serverlist</B>*
<A HREF="#--serverlist">--serverlist</A> Output a <A HREF="eval.html#list">list</A> of server names.
<B><FONT COLOR="PURPLE">Examples </FONT></B>
Edit "file.txt" in an already running GVIM server:
<B> gvim --remote file.txt</B>
Edit "file.txt" in an already running server called FOOBAR:
<B> gvim --servername FOOBAR --remote file.txt</B>
Edit "file.txt" in server "FILES" if <A HREF="motion.html#it">it</A> exists, become server "FILES"
otherwise:
<B> gvim --servername FILES --remote-silent file.txt</B>
This doesn't work, all arguments after <A HREF="#--remote">--remote</A> will be used <A HREF="motion.html#as">as</A> file names:
<B> gvim --remote --servername FOOBAR file.txt</B>
Edit file "+foo" in a remote server (note the use of "./" to avoid the special
meaning of the leading plus):
<B> vim --remote ./+foo</B>
Tell the remote server "BLA" to write all files and exit:
<B> vim --servername BLA --remote-send '<C-\><C-N>:wqa<CR>'</B>
SERVER NAME *<A NAME="client-server-name"></A><B>client-server-name</B>*
By default Vim will try to <A HREF="sponsor.html#register">register</A> the name under which <A HREF="motion.html#it">it</A> was invoked (gvim,
egvim <A HREF="eval.html#...">...</A>). This can be overridden with the <A HREF="#--servername">--servername</A> argument. If the
specified name is not available, a postfix is applied until a free name is
encountered, i.e. "gvim1" for the second invocation of <A HREF="starting.html#gvim">gvim</A> on a particular
X-server. The resulting name is available in the servername builtin variable
|<A HREF="eval.html#v:servername">v:servername</A>|. The <A HREF="change.html#case">case</A> of the server name is ignored, thus "<A HREF="starting.html#gvim">gvim</A>" and
"GVIM" are considered equal.
When Vim is invoked with <A HREF="#--remote">--remote</A>, <A HREF="#--remote-wait">--remote-wait</A> or <A HREF="#--remote-send">--remote-send</A> <A HREF="motion.html#it">it</A> will try
to locate the server name determined by the invocation name and <A HREF="#--servername">--servername</A>
argument <A HREF="motion.html#as">as</A> described above. If an exact match is not available, the first
server with the number postfix will be used. If a name with the number
postfix is specified with the <A HREF="#--servername">--servername</A> argument, <A HREF="motion.html#it">it</A> must match exactly.
If no server can be located and <A HREF="#--remote">--remote</A> or <A HREF="#--remote-wait">--remote-wait</A> was used, Vim will
start up according to the rest of the command line and <A HREF="diff.html#do">do</A> the editing by
itself. This way <A HREF="motion.html#it">it</A> is not necessary to know whether <A HREF="starting.html#gvim">gvim</A> is already started
when sending command to <A HREF="motion.html#it">it</A>.
The <A HREF="#--serverlist">--serverlist</A> argument will cause Vim to print a <A HREF="eval.html#list">list</A> of registered command
servers on the standard output (stdout) and exit.
<A HREF="os_win32.html#Win32">Win32</A> Note: Making the Vim server go to the foreground doesn't always work,
because <A HREF="os_win32.html#MS-Windows">MS-Windows</A> doesn't allow <A HREF="motion.html#it">it</A>. The client will move the server to the
foreground when using the <A HREF="#--remote">--remote</A> or <A HREF="#--remote-wait">--remote-wait</A> argument and the server
name starts with "<A HREF="index.html#g">g</A>".
REMOTE EDITING
The <A HREF="#--remote">--remote</A> argument will cause a |<A HREF="windows.html#:drop">:drop</A>| command to be constructed from the
rest of the command line and sent <A HREF="motion.html#as">as</A> described above.
The <A HREF="#--remote-wait">--remote-wait</A> argument does the same thing and additionally sets up to
wait for each of the files to have been edited. This uses the <A HREF="autocmd.html#BufUnload">BufUnload</A>
event, thus <A HREF="motion.html#as">as</A> soon <A HREF="motion.html#as">as</A> a file has been unloaded, Vim assumes you are done
editing <A HREF="motion.html#it">it</A>.
Note that the <A HREF="#--remote">--remote</A> and <A HREF="#--remote-wait">--remote-wait</A> arguments will consume the rest of
the command line. I.e. all remaining arguments will be regarded <A HREF="motion.html#as">as</A> filenames.
You can not put <A HREF="options.html#options">options</A> there!
FUNCTIONS
*<A NAME="E240"></A><B>E240</B>* *<A NAME="E573"></A><B>E573</B>*
There are a number of Vim <A HREF="eval.html#functions">functions</A> for scripting the command server. See
the description in |<A HREF="eval.html">eval.txt</A>| or use <A HREF="tagsrch.html#CTRL-]">CTRL-]</A> on the function name to jump to
the full explanation.
<B><FONT COLOR="PURPLE"> synopsis explanation </FONT></B>
remote_startserver( name) run a server
remote_expr( server, <A HREF="eval.html#string">string</A>, idvar) send <A HREF="eval.html#expression">expression</A>
remote_send( server, <A HREF="eval.html#string">string</A>, idvar) send key sequence
<A HREF="eval.html#serverlist()">serverlist()</A> get a <A HREF="eval.html#list">list</A> of available servers
remote_peek( serverid, retvar) check for reply <A HREF="eval.html#string">string</A>
remote_read( serverid) read reply <A HREF="eval.html#string">string</A>
server2client( serverid, <A HREF="eval.html#string">string</A>) send reply <A HREF="eval.html#string">string</A>
remote_foreground( server) bring server to the front
See also the explanation of |<A HREF="intro.html#CTRL-\_CTRL-N">CTRL-\_CTRL-N</A>|. Very useful <A HREF="motion.html#as">as</A> a leading key
sequence.
The {serverid} for <A HREF="eval.html#server2client()">server2client()</A> can be obtained with expand("<client>")
==============================================================================
2. <A HREF="options.html#X11">X11</A> specific items *<A NAME="x11-clientserver"></A><B>x11-clientserver</B>*
*<A NAME="E247"></A><B>E247</B>* *<A NAME="E248"></A><B>E248</B>* *<A NAME="E251"></A><B>E251</B>* *<A NAME="E258"></A><B>E258</B>* *<A NAME="E277"></A><B>E277</B>*
The communication between client and server goes through the X server. The
display of the Vim server must be specified. The usual protection of the X
server is used, you must be able to open a <A HREF="windows.html#window">window</A> on the X server for the
communication to work. It is possible to communicate between different
systems.
By default, a <A HREF="gui.html#GUI">GUI</A> Vim will <A HREF="sponsor.html#register">register</A> a name on the X-server by which <A HREF="motion.html#it">it</A> can be
addressed for subsequent execution of injected strings. Vim can also act <A HREF="motion.html#as">as</A>
a client and send strings to other instances of Vim on the same <A HREF="options.html#X11">X11</A> display.
When an <A HREF="options.html#X11">X11</A> <A HREF="gui.html#GUI">GUI</A> Vim (gvim) is started, <A HREF="motion.html#it">it</A> will try to <A HREF="sponsor.html#register">register</A> a send-server
name on the 'VimRegistry' property on the root <A HREF="windows.html#window">window</A>.
A non <A HREF="gui.html#GUI">GUI</A> Vim with access to the <A HREF="options.html#X11">X11</A> display (|<A HREF="term.html#xterm-clipboard">xterm-clipboard</A>| enabled), can
also act <A HREF="motion.html#as">as</A> a command server if a server name is explicitly given with the
<A HREF="#--servername">--servername</A> argument, or when Vim was build with the |<A HREF="various.html#+autoservername">+autoservername</A>|
feature.
An empty <A HREF="#--servername">--servername</A> argument will cause the command server to be disabled.
To send commands to a Vim server from another application, read the source
file src/if_xcmdsrv.c, <A HREF="motion.html#it">it</A> contains some hints about the protocol used.
==============================================================================
3. <A HREF="os_win32.html#Win32">Win32</A> specific items *<A NAME="w32-clientserver"></A><B>w32-clientserver</B>*
Every <A HREF="os_win32.html#Win32">Win32</A> Vim can work <A HREF="motion.html#as">as</A> a server, also in the console. You <A HREF="diff.html#do">do</A> not need a
version compiled with OLE. Windows <A HREF="message.html#messages">messages</A> are used, this works on any
version of <A HREF="os_win32.html#MS-Windows">MS-Windows</A>. But only communication within one system is possible.
Since <A HREF="os_win32.html#MS-Windows">MS-Windows</A> <A HREF="message.html#messages">messages</A> are used, any other application should be able to
communicate with a Vim server. An alternative is using the OLE functionality
|<A HREF="if_ole.html#ole-interface">ole-interface</A>|.
When using <A HREF="starting.html#gvim">gvim</A>, the <A HREF="#--remote-wait">--remote-wait</A> only works properly this way:
<B> start /w gvim --remote-wait file.txt</B>
<A HREF="#top">top</A> - <A HREF="index.html">main help file</A>
</PRE>
</BODY>
</HTML>
|