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