Mercurial > vim
annotate runtime/doc/remote.txt @ 12562:1c049248e9ca v8.0.1159
patch 8.0.1159: typo in #ifdef
commit https://github.com/vim/vim/commit/d371bbe0ab4b07dd3aa8d0f77905d222f6c5fd7e
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 28 22:35:25 2017 +0200
patch 8.0.1159: typo in #ifdef
Problem: Typo in #ifdef.
Solution: Change "PROT" to "PROTO". (Nobuhiro Takasaki, closes https://github.com/vim/vim/issues/2165)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 28 Sep 2017 22:45:04 +0200 |
parents | 4f7081eb1e26 |
children | 1578c0ba0dd1 |
rev | line source |
---|---|
11914 | 1 *remote.txt* For Vim version 8.0. Last change: 2017 Aug 01 |
7 | 2 |
3 | |
4 VIM REFERENCE MANUAL by Bram Moolenaar | |
5 | |
6 | |
7 Vim client-server communication *client-server* | |
8 | |
9 1. Common functionality |clientserver| | |
10 2. X11 specific items |x11-clientserver| | |
11 3. MS-Windows specific items |w32-clientserver| | |
12 | |
13 {Vi does not have any of these commands} | |
14 | |
15 ============================================================================== | |
16 1. Common functionality *clientserver* | |
17 | |
18 When compiled with the |+clientserver| option, Vim can act as a command | |
19 server. It accepts messages from a client and executes them. At the same | |
20 time, Vim can function as a client and send commands to a Vim server. | |
21 | |
22 The following command line arguments are available: | |
23 | |
24 argument meaning ~ | |
25 | |
26 --remote [+{cmd}] {file} ... *--remote* | |
27 Open the file list in a remote Vim. When | |
28 there is no Vim server, execute locally. | |
29 There is one optional init command: +{cmd}. | |
30 This must be an Ex command that can be | |
31 followed by "|". | |
32 The rest of the command line is taken as the | |
33 file list. Thus any non-file arguments must | |
34 come before this. | |
35 You cannot edit stdin this way |--|. | |
36 The remote Vim is raised. If you don't want | |
37 this use > | |
38 vim --remote-send "<C-\><C-N>:n filename<CR>" | |
6648 | 39 < |
40 --remote-silent [+{cmd}] {file} ... *--remote-silent* | |
7 | 41 As above, but don't complain if there is no |
42 server and the file is edited locally. | |
43 --remote-wait [+{cmd}] {file} ... *--remote-wait* | |
44 As --remote, but wait for files to complete | |
45 (unload) in remote Vim. | |
46 --remote-wait-silent [+{cmd}] {file} ... *--remote-wait-silent* | |
47 As --remote-wait, but don't complain if there | |
48 is no server. | |
856 | 49 *--remote-tab* |
733 | 50 --remote-tab Like --remote but open each file in a new |
856 | 51 tabpage. |
52 *--remote-tab-silent* | |
733 | 53 --remote-tab-silent Like --remote-silent but open each file in a |
856 | 54 new tabpage. |
733 | 55 *--remote-tab-wait* |
56 --remote-tab-wait Like --remote-wait but open each file in a new | |
856 | 57 tabpage. |
733 | 58 |
856 | 59 *--remote-tab-wait-silent* |
733 | 60 --remote-tab-wait-silent Like --remote-wait-silent but open each file |
856 | 61 in a new tabpage. |
7 | 62 *--servername* |
63 --servername {name} Become the server {name}. When used together | |
64 with one of the --remote commands: connect to | |
65 server {name} instead of the default (see | |
66 below). | |
67 *--remote-send* | |
1624 | 68 --remote-send {keys} Send {keys} to server and exit. The {keys} |
69 are not mapped. Special key names are | |
70 recognized, e.g., "<CR>" results in a CR | |
71 character. | |
7 | 72 *--remote-expr* |
714 | 73 --remote-expr {expr} Evaluate {expr} in server and print the result |
856 | 74 on stdout. |
7 | 75 *--serverlist* |
76 --serverlist Output a list of server names. | |
77 | |
78 | |
79 Examples ~ | |
80 | |
81 Edit "file.txt" in an already running GVIM server: > | |
82 gvim --remote file.txt | |
83 | |
84 Edit "file.txt" in an already running server called FOOBAR: > | |
85 gvim --servername FOOBAR --remote file.txt | |
86 | |
87 Edit "file.txt" in server "FILES" if it exists, become server "FILES" | |
88 otherwise: > | |
89 gvim --servername FILES --remote-silent file.txt | |
90 | |
91 This doesn't work, all arguments after --remote will be used as file names: > | |
92 gvim --remote --servername FOOBAR file.txt | |
93 | |
94 Edit file "+foo" in a remote server (note the use of "./" to avoid the special | |
95 meaning of the leading plus): > | |
96 vim --remote ./+foo | |
97 | |
98 Tell the remote server "BLA" to write all files and exit: > | |
99 vim --servername BLA --remote-send '<C-\><C-N>:wqa<CR>' | |
100 | |
101 | |
11914 | 102 SERVER NAME *client-server-name* |
7 | 103 |
104 By default Vim will try to register the name under which it was invoked (gvim, | |
105 egvim ...). This can be overridden with the --servername argument. If the | |
106 specified name is not available, a postfix is applied until a free name is | |
237 | 107 encountered, i.e. "gvim1" for the second invocation of gvim on a particular |
7 | 108 X-server. The resulting name is available in the servername builtin variable |
109 |v:servername|. The case of the server name is ignored, thus "gvim" and | |
110 "GVIM" are considered equal. | |
111 | |
112 When Vim is invoked with --remote, --remote-wait or --remote-send it will try | |
113 to locate the server name determined by the invocation name and --servername | |
114 argument as described above. If an exact match is not available, the first | |
115 server with the number postfix will be used. If a name with the number | |
116 postfix is specified with the --servername argument, it must match exactly. | |
117 | |
118 If no server can be located and --remote or --remote-wait was used, Vim will | |
119 start up according to the rest of the command line and do the editing by | |
120 itself. This way it is not necessary to know whether gvim is already started | |
121 when sending command to it. | |
122 | |
123 The --serverlist argument will cause Vim to print a list of registered command | |
124 servers on the standard output (stdout) and exit. | |
125 | |
126 Win32 Note: Making the Vim server go to the foreground doesn't always work, | |
127 because MS-Windows doesn't allow it. The client will move the server to the | |
128 foreground when using the --remote or --remote-wait argument and the server | |
129 name starts with "g". | |
130 | |
131 | |
132 REMOTE EDITING | |
133 | |
134 The --remote argument will cause a |:drop| command to be constructed from the | |
135 rest of the command line and sent as described above. | |
136 The --remote-wait argument does the same thing and additionally sets up to | |
137 wait for each of the files to have been edited. This uses the BufUnload | |
138 event, thus as soon as a file has been unloaded, Vim assumes you are done | |
139 editing it. | |
140 Note that the --remote and --remote-wait arguments will consume the rest of | |
237 | 141 the command line. I.e. all remaining arguments will be regarded as filenames. |
7 | 142 You can not put options there! |
143 | |
144 | |
145 FUNCTIONS | |
146 *E240* *E573* | |
147 There are a number of Vim functions for scripting the command server. See | |
148 the description in |eval.txt| or use CTRL-] on the function name to jump to | |
149 the full explanation. | |
150 | |
151 synopsis explanation ~ | |
11229
146a1e213b60
Update runtime files. Add Rust support.
Christian Brabandt <cb@256bit.org>
parents:
10198
diff
changeset
|
152 remote_startserver( name) run a server |
7 | 153 remote_expr( server, string, idvar) send expression |
154 remote_send( server, string, idvar) send key sequence | |
155 serverlist() get a list of available servers | |
156 remote_peek( serverid, retvar) check for reply string | |
157 remote_read( serverid) read reply string | |
158 server2client( serverid, string) send reply string | |
159 remote_foreground( server) bring server to the front | |
160 | |
161 See also the explanation of |CTRL-\_CTRL-N|. Very useful as a leading key | |
162 sequence. | |
163 The {serverid} for server2client() can be obtained with expand("<client>") | |
164 | |
165 ============================================================================== | |
166 2. X11 specific items *x11-clientserver* | |
167 *E247* *E248* *E251* *E258* *E277* | |
168 | |
169 The communication between client and server goes through the X server. The | |
170 display of the Vim server must be specified. The usual protection of the X | |
171 server is used, you must be able to open a window on the X server for the | |
172 communication to work. It is possible to communicate between different | |
173 systems. | |
174 | |
175 By default, a GUI Vim will register a name on the X-server by which it can be | |
176 addressed for subsequent execution of injected strings. Vim can also act as | |
177 a client and send strings to other instances of Vim on the same X11 display. | |
178 | |
179 When an X11 GUI Vim (gvim) is started, it will try to register a send-server | |
180 name on the 'VimRegistry' property on the root window. | |
181 | |
182 A non GUI Vim with access to the X11 display (|xterm-clipboard| enabled), can | |
183 also act as a command server if a server name is explicitly given with the | |
184 --servername argument. | |
185 | |
186 An empty --servername argument will cause the command server to be disabled. | |
187 | |
188 To send commands to a Vim server from another application, read the source | |
189 file src/if_xcmdsrv.c, it contains some hints about the protocol used. | |
190 | |
191 ============================================================================== | |
192 3. Win32 specific items *w32-clientserver* | |
193 | |
194 Every Win32 Vim can work as a server, also in the console. You do not need a | |
195 version compiled with OLE. Windows messages are used, this works on any | |
196 version of MS-Windows. But only communication within one system is possible. | |
197 | |
198 Since MS-Windows messages are used, any other application should be able to | |
199 communicate with a Vim server. An alternative is using the OLE functionality | |
200 |ole-interface|. | |
201 | |
202 When using gvim, the --remote-wait only works properly this way: > | |
203 | |
204 start /w gvim --remote-wait file.txt | |
205 < | |
206 vim:tw=78:sw=4:ts=8:ft=help:norl: |