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