Mercurial > vim
annotate runtime/doc/netbeans.txt @ 2209:d0ddf7ba1630 vim73
Included the patch to support netbeans in a terminal.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sat, 22 May 2010 18:28:27 +0200 |
parents | b17bbfa96fa0 |
children | 8c6a66e2b3cc |
rev | line source |
---|---|
2154
7c8c7c95a865
First step in the Vim 7.3 branch. Changed version numbers.
Bram Moolenaar <bram@zimbu.org>
parents:
1781
diff
changeset
|
1 *netbeans.txt* For Vim version 7.3a. Last change: 2009 Jan 06 |
7 | 2 |
3 | |
1620 | 4 VIM REFERENCE MANUAL by Gordon Prieur et al. |
7 | 5 |
6 | |
1620 | 7 *socket-interface* *netbeans* *netbeans-support* |
8 | |
9 Vim NetBeans Protocol: a socket interface for Vim integration into an IDE. | |
10 | |
7 | 11 1. Introduction |netbeans-intro| |
1620 | 12 2. Integration features |netbeans-integration| |
7 | 13 3. Configuring Vim for NetBeans |netbeans-configure| |
1620 | 14 4. Error Messages |netbeans-messages| |
15 5. Running Vim in NetBeans mode |netbeans-run| | |
16 6. NetBeans protocol |netbeans-protocol| | |
17 7. NetBeans key |netbeans-key| | |
18 8. Known problems |netbeans-problems| | |
19 9. Debugging NetBeans protocol |netbeans-debugging| | |
20 10. NetBeans External Editor | |
21 10.1. Downloading NetBeans |netbeans-download| | |
22 10.2. NetBeans Key Bindings |netbeans-keybindings| | |
23 10.3. Preparing NetBeans for Vim |netbeans-preparation| | |
24 10.4. Obtaining the External Editor Module |obtaining-exted| | |
25 10.5. Setting up NetBeans to run with Vim |netbeans-setup| | |
7 | 26 |
27 {Vi does not have any of these features} | |
28 {only available when compiled with the |+netbeans_intg| feature} | |
29 | |
30 ============================================================================== | |
31 1. Introduction *netbeans-intro* | |
32 | |
1620 | 33 The NetBeans interface was initially developed to integrate Vim into the |
34 NetBeans Java IDE, using the external editor plugin. This NetBeans plugin no | |
35 longer exists for recent versions of NetBeans but the protocol was developed | |
36 in such a way that any IDE can use it to integrate Vim. | |
37 | |
38 The NetBeans protocol of Vim is a text based communication protocol, over a | |
39 classical TCP socket. There is no dependency on Java or NetBeans. Any language | |
40 or environment providing a socket interface can control Vim using this | |
41 protocol. There are existing implementations in C, C++, Python and Java. The | |
42 name NetBeans is kept today for historical reasons. | |
43 | |
44 Current projects using the NetBeans protocol of Vim are: | |
45 - VimIntegration, description of various projects doing Vim Integration: | |
46 http://www.freehackers.org/VimIntegration | |
47 - Agide, an IDE for the AAP project, written in Python: | |
48 http://www.a-a-p.org | |
49 - Clewn, a gdb integration into Vim, written in C: | |
50 http://clewn.sourceforge.net/ | |
51 - VimPlugin, integration of Vim inside Eclipse: | |
52 http://vimplugin.sourceforge.net/wiki/pmwiki.php | |
53 - PIDA, IDE written in Python integrating Vim: | |
54 http://pida.co.uk/ | |
55 - VimWrapper, library to easy Vim integration into IDE: | |
56 http://www.freehackers.org/VimWrapper | |
57 | |
58 Check the specific project pages to see how to use Vim with these projects. | |
59 | |
60 In the rest of this help page, we will use the term "Vim Controller" to | |
61 describe the program controlling Vim through the NetBeans socket interface. | |
62 | |
63 | |
64 About the NetBeans IDE ~ | |
65 | |
7 | 66 NetBeans is an open source Integrated Development Environment developed |
67 jointly by Sun Microsystems, Inc. and the netbeans.org developer community. | |
68 Initially just a Java IDE, NetBeans has had C, C++, and Fortran support added | |
69 in recent releases. | |
70 | |
1620 | 71 For more information visit the main NetBeans web site http://www.netbeans.org. |
1668 | 72 The External Editor is now, unfortunately, declared obsolete. See |
1620 | 73 http://externaleditor.netbeans.org. |
7 | 74 |
75 Sun Microsystems, Inc. also ships NetBeans under the name Sun ONE Studio. | |
76 Visit http://www.sun.com for more information regarding the Sun ONE Studio | |
77 product line. | |
78 | |
79 Current releases of NetBeans provide full support for Java and limited support | |
236 | 80 for C, C++, and Fortran. Current releases of Sun ONE Studio provide full |
7 | 81 support for Java, C, C++, and Fortran. |
82 | |
83 ============================================================================== | |
1620 | 84 2. Integration features *netbeans-integration* |
7 | 85 |
1620 | 86 The NetBeans socket interface of Vim allows to get information from Vim or to |
87 ask Vim to perform specific actions: | |
88 - get information about buffer: buffer name, cursor position, buffer content, | |
89 etc. | |
90 - be notified when buffers are open or closed | |
91 - be notified of how the buffer content is modified | |
92 - load and save files | |
93 - modify the buffer content | |
94 - installing special key bindings | |
95 - raise the window, control the window geometry | |
7 | 96 |
1620 | 97 For sending key strokes to Vim or for evaluating functions in Vim, you must |
98 use the |clientserver| interface. | |
7 | 99 |
100 | |
101 ============================================================================== | |
102 3. Configuring Vim for NetBeans *netbeans-configure* | |
103 | |
2207
b17bbfa96fa0
Add the settabvar() and gettabvar() functions.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
104 For more help about installing Vim, please read |usr_90.txt| in the Vim User |
b17bbfa96fa0
Add the settabvar() and gettabvar() functions.
Bram Moolenaar <bram@vim.org>
parents:
2154
diff
changeset
|
105 Manual. |
7 | 106 |
107 | |
1620 | 108 On Unix: |
109 -------- | |
7 | 110 |
111 When running configure without arguments the NetBeans interface should be | |
112 included. That is, if the configure check to find out if your system supports | |
113 the required features succeeds. | |
114 | |
115 In case you do not want the NetBeans interface you can disable it by | |
116 uncommenting a line with "--disable-netbeans" in the Makefile. | |
117 | |
2209
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
118 Currently the NetBeans interface is supported by Vim running in a terminal and |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
119 by GVim when it is run with one of the following GUIs: GTK, GNOME, and Motif. |
7 | 120 |
236 | 121 If Motif support is required the user must supply XPM libraries. See |
7 | 122 |workshop-xpm| for details on obtaining the latest version of XPM. |
123 | |
124 | |
1620 | 125 On MS-Windows: |
126 -------------- | |
7 | 127 |
128 The Win32 support is now in beta stage. | |
129 | |
130 To use XPM signs on Win32 (e.g. when using with NetBeans) you can compile | |
131 XPM by yourself or use precompiled libraries from http://iamphet.nm.ru/misc/ | |
132 (for MS Visual C++) or http://gnuwin32.sourceforge.net (for MinGW). | |
133 | |
1620 | 134 Enable debugging: |
135 ----------------- | |
7 | 136 |
1620 | 137 To enable debugging of Vim and of the NetBeans protocol, the "NBDEBUG" macro |
138 needs to be defined. Search in the Makefile of the platform you are using for | |
139 "NBDEBUG" to see what line needs to be uncommented. This effectively adds | |
140 "-DNBDEBUG" to the compile command. Also see |netbeans-debugging| | |
7 | 141 |
142 ============================================================================== | |
1620 | 143 4. Error Messages *netbeans-messages* |
7 | 144 |
1620 | 145 These error messages are specific to NetBeans socket protocol: |
7 | 146 |
147 *E463* | |
148 Region is guarded, cannot modify | |
1620 | 149 The Vim Controller has defined guarded areas in the text, |
150 which you cannot change. Also sets the current buffer, if | |
151 necessary. | |
7 | 152 |
2209
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
153 *E532* |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
154 The defineAnnoType highlighting color name is too long |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
155 The maximum length of the "fg" or "bg" color argument in the |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
156 defineAnnoType command is 32 characters. |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
157 New in version 2.5. |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
158 |
7 | 159 *E656* |
1620 | 160 Writes of unmodified buffers forbidden |
161 Writes of unmodified buffers that were opened from the | |
162 Vim Controller are not possible. | |
7 | 163 |
164 *E657* | |
1620 | 165 Partial writes disallowed |
166 Partial writes for buffers that were opened from the | |
167 Vim Controller are not allowed. | |
7 | 168 |
169 *E658* | |
1620 | 170 Connection lost for this buffer |
171 The Vim Controller has become confused about the state of | |
172 this file. Rather than risk data corruption, it has severed | |
173 the connection for this file. Vim will take over | |
174 responsibility for saving changes to this file and the | |
175 Vim Controller will no longer know of these changes. | |
7 | 176 |
146 | 177 *E744* |
1620 | 178 Read-only file |
146 | 179 Vim normally allows changes to a read-only file and only |
180 enforces the read-only rule if you try to write the file. | |
181 However, NetBeans does not let you make changes to a file | |
1620 | 182 which is read-only and becomes confused if Vim does this. |
183 So Vim does not allow modifications to files when run | |
184 in NetBeans mode. | |
185 | |
7 | 186 ============================================================================== |
1620 | 187 5. Running Vim in NetBeans mode *netbeans-run* |
7 | 188 |
1620 | 189 Vim must be started with the |-nb| argument. Three forms can be used, that |
7 | 190 differ in the way the information for the connection is specified: |
191 | |
192 -nb={fname} from a file | |
193 -nb:{hostname}:{addr}:{password} directly | |
194 -nb from a file or environment | |
195 | |
196 *E660* *E668* | |
197 For security reasons, the best method is to write the information in a file | |
198 readable only by the user. The name of the file can be passed with the | |
199 "-nb={fname}" argument or, when "-nb" is used without a parameter, the | |
200 environment variable "__NETBEANS_CONINFO". The file must contain these three | |
201 lines, in any order: | |
202 | |
203 host={hostname} | |
204 port={addr} | |
205 auth={password} | |
206 | |
207 Other lines are ignored. The caller of Vim is responsible for deleting the | |
208 file afterwards. | |
209 | |
1620 | 210 {hostname} is the name of the machine where Vim Controller is running. When |
211 omitted the environment variable "__NETBEANS_HOST" is used or the default | |
212 "localhost". | |
7 | 213 |
1620 | 214 {addr} is the port number for the NetBeans interface. When omitted the |
215 environment variable "__NETBEANS_SOCKET" is used or the default 3219. | |
7 | 216 |
217 {password} is the password for connecting to NetBeans. When omitted the | |
218 environment variable "__NETBEANS_VIM_PASSWORD" is used or "changeme". | |
219 | |
1620 | 220 Vim will initiate a socket connection (client side) to the specified host and |
221 port upon startup. The password will be sent with the AUTH event when the | |
222 connection has been established. | |
223 | |
7 | 224 |
1620 | 225 ============================================================================== |
226 6. NetBeans protocol *netbeans-protocol* | |
227 | |
228 The communication between the Vim Controller and Vim uses plain text | |
229 messages. This protocol was first designed to work with the external editor | |
230 module of NetBeans. Later it was extended to work with Agide (A-A-P GUI IDE, | |
231 see http://www.a-a-p.org) and then with other IDE. The extensions are marked | |
232 with "version 2.1". | |
7 | 233 |
236 | 234 Version 2.2 of the protocol has several minor changes which should only affect |
235 NetBeans users (ie, not Agide users). However, a bug was fixed which could | |
236 cause confusion. The netbeans_saved() function sent a "save" protocol | |
237 command. In protocol version 2.1 and earlier this was incorrectly interpreted | |
238 as a notification that a write had taken place. In reality, it told NetBeans | |
239 to save the file so multiple writes were being done. This caused various | |
240 problems and has been fixed in 2.2. To decrease the likelihood of this | |
7 | 241 confusion happening again, netbeans_saved() has been renamed to |
242 netbeans_save_buffer(). | |
243 | |
2209
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
244 We are now at version 2.5. For the differences between 2.4 and 2.5 search for |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
245 "2.5" below. |
718 | 246 |
7 | 247 The messages are currently sent over a socket. Since the messages are in |
248 plain UTF-8 text this protocol could also be used with any other communication | |
249 mechanism. | |
250 | |
1620 | 251 6.1 Kinds of messages |nb-messages| |
252 6.2 Terms |nb-terms| | |
253 6.3 Commands |nb-commands| | |
254 6.4 Functions and Replies |nb-functions| | |
255 6.5 Events |nb-events| | |
256 6.6 Special messages |nb-special| | |
257 6.7 Protocol errors |nb-protocol_errors| | |
718 | 258 |
259 | |
1620 | 260 6.1 Kinds of messages *nb-messages* |
7 | 261 |
262 There are four kinds of messages: | |
263 | |
264 kind direction comment ~ | |
265 Command IDE -> editor no reply necessary | |
266 Function IDE -> editor editor must send back a reply | |
267 Reply editor -> IDE only in response to a Function | |
268 Event editor -> IDE no reply necessary | |
269 | |
270 The messages are sent as a single line with a terminating newline character. | |
271 Arguments are separated by a single space. The first item of the message | |
272 depends on the kind of message: | |
273 | |
274 kind first item example ~ | |
275 Command bufID:name!seqno 11:showBalloon!123 "text" | |
276 Function bufID:name/seqno 11:getLength/123 | |
277 Reply seqno 123 5000 | |
1620 | 278 Event bufID:name=seqno 11:keyCommand=123 "S-F2" |
7 | 279 |
280 | |
1620 | 281 |
282 6.2 Terms *nb-terms* | |
7 | 283 |
284 bufID Buffer number. A message may be either for a specific buffer | |
285 or generic. Generic messages use a bufID of zero. NOTE: this | |
286 buffer ID is assigned by the IDE, it is not Vim's buffer | |
287 number. The bufID must be a sequentially rising number, | |
288 starting at one. | |
289 | |
290 seqno The IDE uses a sequence number for Commands and Functions. A | |
291 Reply must use the sequence number of the Function that it is | |
292 associated with. A zero sequence number can be used for | |
293 Events (the seqno of the last received Command or Function can | |
294 also be used). | |
295 | |
296 string Argument in double quotes. Text is in UTF-8 encoding. This | |
297 means ASCII is passed as-is. Special characters are | |
298 represented with a backslash: | |
299 \" double quote | |
300 \n newline | |
301 \r carriage-return | |
302 \t tab (optional, also works literally) | |
303 \\ backslash | |
304 NUL bytes are not allowed! | |
305 | |
306 boolean Argument with two possible values: | |
307 T true | |
308 F false | |
309 | |
310 number Argument with a decimal number. | |
311 | |
2209
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
312 color Argument with either a decimal number, "none" (without the |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
313 quotes) or the name of a color (without the quotes) defined |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
314 both in the color list in|highlight-ctermfg| and in the color |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
315 list in|gui-colors|. |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
316 New in version 2.5. |
7 | 317 |
318 offset A number argument that indicates a byte position in a buffer. | |
319 The first byte has offset zero. Line breaks are counted for | |
320 how they appear in the file (CR/LF counts for two bytes). | |
321 Note that a multi-byte character is counted for the number of | |
322 bytes it takes. | |
323 | |
324 lnum/col Argument with a line number and column number position. The | |
325 line number starts with one, the column is the byte position, | |
326 starting with zero. Note that a multi-byte character counts | |
327 for several columns. | |
328 | |
329 pathname String argument: file name with full path. | |
330 | |
331 | |
1620 | 332 6.3 Commands *nb-commands* |
7 | 333 |
334 actionMenuItem Not implemented. | |
335 | |
336 actionSensitivity | |
337 Not implemented. | |
338 | |
339 addAnno serNum typeNum off len | |
340 Place an annotation in this buffer. | |
341 Arguments: | |
342 serNum number serial number of this placed | |
343 annotation, used to be able to remove | |
344 it | |
345 typeNum number sequence number of the annotation | |
346 defined with defineAnnoType for this | |
347 buffer | |
348 off number offset where annotation is to be placed | |
349 len number not used | |
350 In version 2.1 "lnum/col" can be used instead of "off". | |
351 | |
352 balloonResult text | |
353 Not implemented. | |
354 | |
355 close Close the buffer. This leaves us without current buffer, very | |
356 dangerous to use! | |
357 | |
358 create Creates a buffer without a name. Replaces the current buffer | |
359 (it's hidden when it was changed). | |
1620 | 360 The Vim Controller should use this as the first command for a |
361 file that is being opened. The sequence of commands could be: | |
7 | 362 create |
363 setCaretListener (ignored) | |
364 setModified (no effect) | |
365 setContentType (ignored) | |
366 startDocumentListen | |
367 setTitle | |
368 setFullName | |
369 | |
370 defineAnnoType typeNum typeName tooltip glyphFile fg bg | |
371 Define a type of annotation for this buffer. | |
372 Arguments: | |
373 typeNum number sequence number (not really used) | |
374 typeName string name that identifies this annotation | |
375 tooltip string not used | |
376 glyphFile string name of icon file | |
2209
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
377 fg color foreground color for line highlighting |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
378 bg color background color for line highlighting |
7 | 379 Vim will define a sign for the annotation. |
2209
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
380 When color is a number, this is the "#rrggbb" Red, Green and |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
381 Blue values of the color (see |gui-colors|) and the |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
382 highlighting is only defined for GVim. |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
383 When color is a name, this color is defined both for Vim |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
384 running in a color terminal and for GVim. |
7 | 385 When both "fg" and "bg" are "none" no line highlighting is |
386 used (new in version 2.1). | |
387 When "glyphFile" is empty, no text sign is used (new in | |
388 version 2.1). | |
389 When "glyphFile" is one or two characters long, a text sign is | |
390 defined (new in version 2.1). | |
391 Note: the annotations will be defined in sequence, and the | |
392 sequence number is later used with addAnno. | |
393 | |
394 editFile pathname | |
395 Set the name for the buffer and edit the file "pathname", a | |
396 string argument. | |
1620 | 397 Normal way for the IDE to tell the editor to edit a file. |
398 | |
399 You must set a bufId different of 0 with this command to | |
400 assign a bufId to the buffer. It will trigger an event | |
401 fileOpened with a bufId of 0 but the buffer has been assigned. | |
402 | |
403 If the IDE is going to pass the file text to the editor use | |
404 these commands instead: | |
7 | 405 setFullName |
406 insert | |
407 initDone | |
408 New in version 2.1. | |
409 | |
410 enableBalloonEval | |
411 Not implemented. | |
412 | |
413 endAtomic End an atomic operation. The changes between "startAtomic" | |
414 and "endAtomic" can be undone as one operation. But it's not | |
415 implemented yet. Redraw when necessary. | |
416 | |
417 guard off len | |
418 Mark an area in the buffer as guarded. This means it cannot | |
419 be edited. "off" and "len" are numbers and specify the text | |
420 to be guarded. | |
421 | |
422 initDone Mark the buffer as ready for use. Implicitly makes the buffer | |
423 the current buffer. Fires the BufReadPost autocommand event. | |
424 | |
33 | 425 insertDone |
1620 | 426 Sent by Vim Controller to tell Vim an initial file insert is |
427 done. This triggers a read message being printed. Prior to | |
428 version 2.3, no read messages were displayed after opening a | |
429 file. New in version 2.3. | |
33 | 430 |
7 | 431 moveAnnoToFront serNum |
432 Not implemented. | |
433 | |
434 netbeansBuffer isNetbeansBuffer | |
1668 | 435 If "isNetbeansBuffer" is "T" then this buffer is "owned" by |
7 | 436 NetBeans. |
437 New in version 2.2. | |
438 | |
439 putBufferNumber pathname | |
440 Associate a buffer number with the Vim buffer by the name | |
441 "pathname", a string argument. To be used when the editor | |
442 reported editing another file to the IDE and the IDE needs to | |
443 tell the editor what buffer number it will use for this file. | |
444 Also marks the buffer as initialized. | |
445 New in version 2.1. | |
446 | |
447 raise Bring the editor to the foreground. | |
2209
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
448 Only when Vim is run with a GUI. |
7 | 449 New in version 2.1. |
450 | |
451 removeAnno serNum | |
452 Remove a previously place annotation for this buffer. | |
453 "serNum" is the same number used in addAnno. | |
454 | |
455 save Save the buffer when it was modified. The other side of the | |
456 interface is expected to write the buffer and invoke | |
457 "setModified" to reset the "changed" flag of the buffer. | |
458 The writing is skipped when one of these conditions is true: | |
459 - 'write' is not set | |
460 - the buffer is read-only | |
461 - the buffer does not have a file name | |
462 - 'buftype' disallows writing | |
463 New in version 2.2. | |
464 | |
33 | 465 saveDone |
1620 | 466 Sent by Vim Controller to tell Vim a save is done. This |
467 triggers a save message being printed. Prior to version 2.3, | |
468 no save messages were displayed after a save. | |
33 | 469 New in version 2.3. |
470 | |
7 | 471 setAsUser Not implemented. |
472 | |
473 setBufferNumber pathname | |
474 Associate a buffer number with Vim buffer by the name | |
475 "pathname". To be used when the editor reported editing | |
476 another file to the IDE and the IDE needs to tell the editor | |
477 what buffer number it will use for this file. | |
478 Has the side effect of making the buffer the current buffer. | |
479 See "putBufferNumber" for a more useful command. | |
480 | |
481 setContentType | |
482 Not implemented. | |
483 | |
484 setDot off Make the buffer the current buffer and set the cursor at the | |
659 | 485 specified position. If the buffer is open in another window |
486 than make that window the current window. | |
487 If there are folds they are opened to make the cursor line | |
488 visible. | |
7 | 489 In version 2.1 "lnum/col" can be used instead of "off". |
490 | |
491 setExitDelay seconds | |
492 Set the delay for exiting to "seconds", a number. | |
493 This delay is used to give the IDE a chance to handle things | |
494 before really exiting. The default delay is two seconds. | |
495 New in version 2.1. | |
33 | 496 Obsolete in version 2.3. |
7 | 497 |
498 setFullName pathname | |
499 Set the file name to be used for a buffer to "pathname", a | |
500 string argument. | |
501 Used when the IDE wants to edit a file under control of the | |
502 IDE. This makes the buffer the current buffer, but does not | |
503 read the file. "insert" commands will be used next to set the | |
504 contents. | |
505 | |
506 setLocAndSize Not implemented. | |
507 | |
508 setMark Not implemented. | |
509 | |
510 setModified modified | |
511 When the boolean argument "modified" is "T" mark the buffer as | |
512 modified, when it is "F" mark it as unmodified. | |
513 | |
33 | 514 setModtime time |
1620 | 515 Update a buffers modification time after the file has been |
516 saved directly by the Vim Controller. | |
33 | 517 New in version 2.3. |
518 | |
519 setReadOnly | |
1620 | 520 Set a file as readonly |
521 Implemented in version 2.3. | |
7 | 522 |
523 setStyle Not implemented. | |
524 | |
525 setTitle name | |
526 Set the title for the buffer to "name", a string argument. | |
1620 | 527 The title is only used for the Vim Controller functions, not |
528 by Vim. | |
7 | 529 |
530 setVisible visible | |
531 When the boolean argument "visible" is "T", goto the buffer. | |
532 The "F" argument does nothing. | |
533 | |
534 showBalloon text | |
535 Show a balloon (popup window) at the mouse pointer position, | |
536 containing "text", a string argument. The balloon should | |
537 disappear when the mouse is moved more than a few pixels. | |
2209
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
538 Only when Vim is run with a GUI. |
7 | 539 New in version 2.1. |
540 | |
33 | 541 specialKeys |
542 Map a set of keys (mostly function keys) to be passed back | |
1620 | 543 to the Vim Controller for processing. This lets regular IDE |
544 hotkeys be used from Vim. | |
33 | 545 Implemented in version 2.3. |
7 | 546 |
547 startAtomic Begin an atomic operation. The screen will not be updated | |
548 until "endAtomic" is given. | |
549 | |
550 startCaretListen | |
551 Not implemented. | |
552 | |
553 startDocumentListen | |
554 Mark the buffer to report changes to the IDE with the | |
555 "insert" and "remove" events. The default is to report | |
556 changes. | |
557 | |
558 stopCaretListen | |
559 Not implemented. | |
560 | |
561 stopDocumentListen | |
562 Mark the buffer to stop reporting changes to the IDE. | |
563 Opposite of startDocumentListen. | |
153 | 564 NOTE: if "netbeansBuffer" was used to mark this buffer as a |
565 NetBeans buffer, then the buffer is deleted in Vim. This is | |
566 for compatibility with Sun Studio 10. | |
7 | 567 |
568 unguard off len | |
569 Opposite of "guard", remove guarding for a text area. | |
659 | 570 Also sets the current buffer, if necessary. |
7 | 571 |
572 version Not implemented. | |
573 | |
574 | |
1620 | 575 6.4 Functions and Replies *nb-functions* |
7 | 576 |
577 getDot Not implemented. | |
578 | |
579 getCursor Return the current buffer and cursor position. | |
580 The reply is: | |
581 seqno bufID lnum col off | |
582 seqno = sequence number of the function | |
583 bufID = buffer ID of the current buffer (if this is unknown -1 | |
584 is used) | |
585 lnum = line number of the cursor (first line is one) | |
586 col = column number of the cursor (in bytes, zero based) | |
587 off = offset of the cursor in the buffer (in bytes) | |
588 New in version 2.1. | |
589 | |
590 getLength Return the length of the buffer in bytes. | |
591 Reply example for a buffer with 5000 bytes: | |
592 123 5000 | |
593 TODO: explain use of partial line. | |
594 | |
595 getMark Not implemented. | |
596 | |
1037 | 597 getAnno serNum |
598 Return the line number of the annotation in the buffer. | |
599 Argument: | |
600 serNum serial number of this placed annotation | |
601 The reply is: | |
602 123 lnum line number of the annotation | |
603 123 0 invalid annotation serial number | |
604 New in version 2.4. | |
605 | |
7 | 606 getModified When a buffer is specified: Return zero if the buffer does not |
607 have changes, one if it does have changes. | |
608 When no buffer is specified (buffer number zero): Return the | |
609 number of buffers with changes. When the result is zero it's | |
610 safe to tell Vim to exit. | |
611 New in version 2.1. | |
612 | |
613 getText Return the contents of the buffer as a string. | |
614 Reply example for a buffer with two lines | |
615 123 "first line\nsecond line\n" | |
616 NOTE: docs indicate an offset and length argument, but this is | |
617 not implemented. | |
618 | |
619 insert off text | |
620 Insert "text" before position "off". "text" is a string | |
621 argument, "off" a number. | |
1620 | 622 "text" should have a "\n" (newline) at the end of each line. |
718 | 623 Or "\r\n" when 'fileformat' is "dos". When using "insert" in |
624 an empty buffer Vim will set 'fileformat' accordingly. | |
625 When "off" points to the start of a line the text is inserted | |
626 above this line. Thus when "off" is zero lines are inserted | |
627 before the first line. | |
628 When "off" points after the start of a line, possibly on the | |
629 NUL at the end of a line, the first line of text is appended | |
630 to this line. Further lines come below it. | |
7 | 631 Possible replies: |
632 123 no problem | |
633 123 !message failed | |
634 Note that the message in the reply is not quoted. | |
659 | 635 Also sets the current buffer, if necessary. |
718 | 636 Does not move the cursor to the changed text. |
637 Resets undo information. | |
7 | 638 |
639 remove off length | |
640 Delete "length" bytes of text at position "off". Both | |
641 arguments are numbers. | |
642 Possible replies: | |
643 123 no problem | |
644 123 !message failed | |
645 Note that the message in the reply is not quoted. | |
659 | 646 Also sets the current buffer, if necessary. |
7 | 647 |
648 saveAndExit Perform the equivalent of closing Vim: ":confirm qall". | |
649 If there are no changed files or the user does not cancel the | |
650 operation Vim exits and no result is sent back. The IDE can | |
651 consider closing the connection as a successful result. | |
652 If the user cancels the operation the number of modified | |
653 buffers that remains is returned and Vim does not exit. | |
654 New in version 2.1. | |
655 | |
656 | |
1620 | 657 6.5 Events *nb-events* |
7 | 658 |
659 balloonEval off len type | |
660 The mouse pointer rests on text for a short while. When "len" | |
661 is zero, there is no selection and the pointer is at position | |
662 "off". When "len" is non-zero the text from position "off" to | |
663 "off" + "len" is selected. | |
664 Only sent after "enableBalloonEval" was used for this buffer. | |
665 "type" is not yet defined. | |
666 Not implemented yet. | |
667 | |
668 balloonText text | |
669 Used when 'ballooneval' is set and the mouse pointer rests on | |
670 some text for a moment. "text" is a string, the text under | |
671 the mouse pointer. | |
2209
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
672 Only when Vim is run with a GUI. |
7 | 673 New in version 2.1. |
674 | |
675 buttonRelease button lnum col | |
676 Report which button was pressed and the location of the cursor | |
677 at the time of the release. Only for buffers that are owned | |
1620 | 678 by the Vim Controller. This event is not sent if the button |
679 was released while the mouse was in the status line or in a | |
236 | 680 separator line. If col is less than 1 the button release was |
7 | 681 in the sign area. |
682 New in version 2.2. | |
683 | |
33 | 684 disconnect |
1620 | 685 Tell the Vim Controller that Vim is exiting and not to try and |
686 read or write more commands. | |
33 | 687 New in version 2.3. |
688 | |
7 | 689 fileClosed Not implemented. |
690 | |
691 fileModified Not implemented. | |
692 | |
693 fileOpened pathname open modified | |
694 A file was opened by the user. | |
695 Arguments: | |
696 pathname string name of the file | |
697 open boolean always "T" | |
698 modified boolean always "F" | |
699 | |
700 geometry cols rows x y | |
701 Report the size and position of the editor window. | |
702 Arguments: | |
703 cols number number of text columns | |
704 rows number number of text rows | |
705 x number pixel position on screen | |
706 y number pixel position on screen | |
707 Only works for Motif. | |
708 | |
709 insert off text | |
710 Text "text" has been inserted in Vim at position "off". | |
711 Only fired when enabled, see "startDocumentListen". | |
712 | |
713 invokeAction Not implemented. | |
714 | |
715 keyCommand keyName | |
716 Reports a special key being pressed with name "keyName", which | |
717 is a string. | |
718 Supported key names: | |
719 F1 function key 1 | |
720 F2 function key 2 | |
721 ... | |
722 F12 function key 12 | |
723 | |
724 ' ' space (without the quotes) | |
725 ! exclamation mark | |
726 ... any other ASCII printable character | |
727 ~ tilde | |
728 | |
729 X any unrecognized key | |
730 | |
731 The key may be prepended by "C", "S" and/or "M" for Control, | |
732 Shift and Meta (Alt) modifiers. If there is a modifier a dash | |
733 is used to separate it from the key name. For example: | |
734 "C-F2". | |
735 ASCII characters are new in version 2.1. | |
736 | |
737 keyAtPos keyName lnum/col | |
738 Like "keyCommand" and also report the line number and column | |
739 of the cursor. | |
740 New in version 2.1. | |
741 | |
1781 | 742 killed A file was deleted or wiped out by the user and the buffer |
743 annotations have been removed. The bufID number for this | |
744 buffer has become invalid. Only for files that have been | |
745 assigned a bufID number by the IDE. | |
7 | 746 |
747 newDotAndMark off off | |
748 Reports the position of the cursor being at "off" bytes into | |
749 the buffer. Only sent just before a "keyCommand" event. | |
750 | |
751 quit Not implemented. | |
752 | |
753 remove off len | |
754 Text was deleted in Vim at position "off" with byte length | |
755 "len". | |
756 Only fired when enabled, see "startDocumentListen". | |
757 | |
758 revert Not implemented. | |
759 | |
760 save The buffer has been saved and is now unmodified. | |
761 Only fired when enabled, see "startDocumentListen". | |
762 | |
763 startupDone The editor has finished its startup work and is ready for | |
764 editing files. | |
765 New in version 2.1. | |
766 | |
767 unmodified The buffer is now unmodified. | |
768 Only fired when enabled, see "startDocumentListen". | |
769 | |
770 version vers Report the version of the interface implementation. Vim | |
1620 | 771 reports "2.4" (including the quotes). |
7 | 772 |
773 | |
1620 | 774 6.6 Special messages *nb-special* |
7 | 775 |
776 These messages do not follow the style of the messages above. They are | |
777 terminated by a newline character. | |
778 | |
779 ACCEPT Not used. | |
780 | |
781 AUTH password editor -> IDE: First message that the editor sends to the IDE. | |
782 Must contain the password for the socket server, as specified | |
783 with the |-nb| argument. No quotes are used! | |
784 | |
785 DISCONNECT IDE -> editor: break the connection. The editor will exit. | |
786 The IDE must only send this message when there are no unsaved | |
787 changes! | |
788 | |
789 DETACH IDE -> editor: break the connection without exiting the | |
790 editor. Used when the IDE exits without bringing down the | |
791 editor as well. | |
792 New in version 2.1. | |
793 | |
794 REJECT Not used. | |
795 | |
1620 | 796 |
797 6.7 Protocol errors *nb-protocol_errors* | |
798 | |
799 These errors occur when a message violates the protocol: | |
800 *E627* *E628* *E629* *E630* *E631* *E632* *E633* *E634* *E635* *E636* | |
801 *E637* *E638* *E639* *E640* *E641* *E642* *E643* *E644* *E645* *E646* | |
802 *E647* *E648* *E649* *E650* *E651* *E652* *E653* *E654* | |
803 | |
804 | |
7 | 805 ============================================================================== |
1620 | 806 7. NetBeans key *netbeans-key* |
146 | 807 |
808 *:nbkey* | |
1620 | 809 :nbkey key Pass the key to the Vim Controller for processing |
146 | 810 |
1620 | 811 When a hot-key has been installed with the specialKeys command, this command |
812 can be used to generate a hotkey messages to the Vim Controller. The events | |
813 newDotAndMark, keyCommand and keyAtPos are generated (in this order). | |
814 | |
146 | 815 |
816 ============================================================================== | |
1620 | 817 8. Known problems *netbeans-problems* |
7 | 818 |
819 NUL bytes are not possible. For editor -> IDE they will appear as NL | |
820 characters. For IDE -> editor they cannot be inserted. | |
821 | |
2209
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
822 A NetBeans session may be initiated with Vim running in a terminal, and |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
823 continued later in a GUI environment after running the |:gui|command. In this |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
824 case, the highlighting defined for the NetBeans annotations may be cleared |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
825 when the ":gui" command sources .gvimrc and this file loads a colorscheme |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
826 that runs the command ":highlight clear". |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
827 New in version 2.5. |
d0ddf7ba1630
Included the patch to support netbeans in a terminal.
Bram Moolenaar <bram@vim.org>
parents:
2207
diff
changeset
|
828 |
7 | 829 |
1620 | 830 ============================================================================== |
831 9. Debugging NetBeans protocol *netbeans-debugging* | |
832 | |
833 To debug the Vim protocol, you must first compile Vim with debugging support | |
834 and NetBeans debugging support. See |netbeans-configure| for instructions | |
835 about Vim compiling and how to enable debug support. | |
836 | |
837 When running Vim, set the following environment variables: | |
838 | |
839 export SPRO_GVIM_DEBUG=netbeans.log | |
840 export SPRO_GVIM_DLEVEL=0xffffffff | |
841 | |
842 Vim will then log all the incoming and outgoing messages of the NetBeans | |
843 protocol to the file netbeans.log . | |
844 | |
845 The content of netbeans.log after a session looks like this: | |
846 Tue May 20 17:19:27 2008 | |
847 EVT: 0:startupDone=0 | |
848 CMD 1: (1) create | |
849 CMD 2: (1) setTitle "testfile1.txt" | |
850 CMD 3: (1) setFullName "testfile1.txt" | |
851 EVT(suppressed): 1:remove=3 0 -1 | |
852 EVT: 1:fileOpened=0 "d:\\work\\vimWrapper\\vimWrapper2\\pyvimwrapper\\tests\\testfile1.txt" T F | |
853 CMD 4: (1) initDone | |
854 FUN 5: (0) getCursor | |
855 REP 5: 1 1 0 0 | |
856 CMD 6: (2) create | |
857 CMD 7: (2) setTitle "testfile2.txt" | |
858 CMD 8: (2) setFullName "testfile2.txt" | |
859 EVT(suppressed): 2:remove=8 0 -1 | |
860 EVT: 2:fileOpened=0 "d:\\work\\vimWrapper\\vimWrapper2\\pyvimwrapper\\tests\\testfile2.txt" T F | |
861 CMD 9: (2) initDone | |
862 | |
863 | |
864 ============================================================================== | |
865 10. NetBeans External Editor | |
866 | |
867 NOTE: This information is obsolete! Only relevant if you are using an old | |
868 version of NetBeans. | |
869 | |
870 | |
871 10.1. Downloading NetBeans *netbeans-download* | |
872 | |
873 The NetBeans IDE is available for download from netbeans.org. You can download | |
874 a released version, download sources, or use CVS to download the current | |
875 source tree. If you choose to download sources, follow directions from | |
876 netbeans.org on building NetBeans. | |
877 | |
878 Depending on the version of NetBeans you download, you may need to do further | |
879 work to get the required External Editor module. This is the module which lets | |
880 NetBeans work with gvim (or xemacs :-). See http://externaleditor.netbeans.org | |
881 for details on downloading this module if your NetBeans release does not have | |
882 it. | |
883 | |
884 For C, C++, and Fortran support you will also need the cpp module. See | |
885 http://cpp.netbeans.org for information regarding this module. | |
886 | |
887 You can also download Sun ONE Studio from Sun Microsystems, Inc for a 30 day | |
888 free trial. See http://www.sun.com for further details. | |
889 | |
890 | |
891 10.2. NetBeans Key Bindings *netbeans-keybindings* | |
892 | |
893 Vim understands a number of key bindings that execute NetBeans commands. | |
894 These are typically all the Function key combinations. To execute a NetBeans | |
895 command, the user must press the Pause key followed by a NetBeans key binding. | |
896 For example, in order to compile a Java file, the NetBeans key binding is | |
897 "F9". So, while in vim, press "Pause F9" to compile a java file. To toggle a | |
898 breakpoint at the current line, press "Pause Shift F8". | |
899 | |
900 The Pause key is Function key 21. If you don't have a working Pause key and | |
901 want to use F8 instead, use: > | |
902 | |
903 :map <F8> <F21> | |
904 | |
905 The External Editor module dynamically reads the NetBeans key bindings so vim | |
906 should always have the latest key bindings, even when NetBeans changes them. | |
907 | |
908 | |
909 10.3. Preparing NetBeans for Vim *netbeans-preparation* | |
910 | |
911 In order for NetBeans to work with vim, the NetBeans External Editor module | |
912 must be loaded and enabled. If you have a Sun ONE Studio Enterprise Edition | |
913 then this module should be loaded and enabled. If you have a NetBeans release | |
914 you may need to find another way of obtaining this open source module. | |
915 | |
916 You can check if you have this module by opening the Tools->Options dialog | |
917 and drilling down to the "Modules" list (IDE Configuration->System->Modules). | |
918 If your Modules list has an entry for "External Editor" you must make sure | |
919 it is enabled (the "Enabled" property should have the value "True"). If your | |
920 Modules list has no External Editor see the next section on |obtaining-exted|. | |
921 | |
922 | |
923 10.4. Obtaining the External Editor Module *obtaining-exted* | |
924 | |
925 There are 2 ways of obtaining the External Editor module. The easiest way | |
926 is to use the NetBeans Update Center to download and install the module. | |
927 Unfortunately, some versions do not have this module in their update | |
928 center. If you cannot download via the update center you will need to | |
929 download sources and build the module. I will try and get the module | |
930 available from the NetBeans Update Center so building will be unnecessary. | |
931 Also check http://externaleditor.netbeans.org for other availability options. | |
932 | |
933 To download the External Editor sources via CVS and build your own module, | |
934 see http://externaleditor.netbeans.org and http://www.netbeans.org. | |
935 Unfortunately, this is not a trivial procedure. | |
936 | |
937 | |
938 10.5. Setting up NetBeans to run with Vim *netbeans-setup* | |
939 | |
940 Assuming you have loaded and enabled the NetBeans External Editor module | |
941 as described in |netbeans-preparation| all you need to do is verify that | |
942 the gvim command line is properly configured for your environment. | |
943 | |
944 Open the Tools->Options dialog and open the Editing category. Select the | |
945 External Editor. The right hand pane should contain a Properties tab and | |
946 an Expert tab. In the Properties tab make sure the "Editor Type" is set | |
947 to "Vim". In the Expert tab make sure the "Vim Command" is correct. | |
948 | |
949 You should be careful if you change the "Vim Command". There are command | |
950 line options there which must be there for the connection to be properly | |
951 set up. You can change the command name but that's about it. If your gvim | |
952 can be found by your $PATH then the VIM Command can start with "gvim". If | |
953 you don't want gvim searched from your $PATH then hard code in the full | |
954 Unix path name. At this point you should get a gvim for any source file | |
955 you open in NetBeans. | |
956 | |
957 If some files come up in gvim and others (with different file suffixes) come | |
958 up in the default NetBeans editor you should verify the MIME type in the | |
959 Expert tab MIME Type property. NetBeans is MIME oriented and the External | |
960 Editor will only open MIME types specified in this property. | |
961 | |
962 | |
7 | 963 vim:tw=78:ts=8:ft=help:norl: |