Mercurial > vim
comparison runtime/doc/netbeans.txt @ 1620:73fe8baea242
updated for version 7.2a
author | vimboss |
---|---|
date | Tue, 24 Jun 2008 21:16:56 +0000 |
parents | 5bed56fce2b5 |
children | 0b796e045c42 |
comparison
equal
deleted
inserted
replaced
1619:b9740fb41986 | 1620:73fe8baea242 |
---|---|
1 *netbeans.txt* For Vim version 7.1. Last change: 2006 Nov 14 | 1 *netbeans.txt* For Vim version 7.2a. Last change: 2008 Jun 22 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Gordon Prieur | 4 VIM REFERENCE MANUAL by Gordon Prieur et al. |
5 | 5 |
6 | 6 |
7 NetBeans ExternalEditor Integration Features *netbeans* | 7 *socket-interface* *netbeans* *netbeans-support* |
8 *netbeans-support* | 8 |
9 Vim NetBeans Protocol: a socket interface for Vim integration into an IDE. | |
10 | |
9 1. Introduction |netbeans-intro| | 11 1. Introduction |netbeans-intro| |
10 2. NetBeans Key Bindings |netbeans-keybindings| | 12 2. Integration features |netbeans-integration| |
11 3. Configuring Vim for NetBeans |netbeans-configure| | 13 3. Configuring Vim for NetBeans |netbeans-configure| |
12 4. Downloading NetBeans |netbeans-download| | 14 4. Error Messages |netbeans-messages| |
13 5. Preparing NetBeans for Vim |netbeans-preparation| | 15 5. Running Vim in NetBeans mode |netbeans-run| |
14 6. Obtaining the External Editor Module |obtaining-exted| | 16 6. NetBeans protocol |netbeans-protocol| |
15 7. Setting up NetBeans to run with Vim |netbeans-setup| | 17 7. NetBeans key |netbeans-key| |
16 8. Messages |netbeans-messages| | 18 8. Known problems |netbeans-problems| |
17 9. Running Vim from NetBeans |netbeans-run| | 19 9. Debugging NetBeans protocol |netbeans-debugging| |
18 10. NetBeans protocol |netbeans-protocol| | 20 10. NetBeans External Editor |
19 11. NetBeans commands |netbeans-commands| | 21 10.1. Downloading NetBeans |netbeans-download| |
20 12. Known problems |netbeans-problems| | 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| | |
21 | 26 |
22 {Vi does not have any of these features} | 27 {Vi does not have any of these features} |
23 {only available when compiled with the |+netbeans_intg| feature} | 28 {only available when compiled with the |+netbeans_intg| feature} |
24 | 29 |
25 ============================================================================== | 30 ============================================================================== |
26 1. Introduction *netbeans-intro* | 31 1. Introduction *netbeans-intro* |
32 | |
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 ~ | |
27 | 65 |
28 NetBeans is an open source Integrated Development Environment developed | 66 NetBeans is an open source Integrated Development Environment developed |
29 jointly by Sun Microsystems, Inc. and the netbeans.org developer community. | 67 jointly by Sun Microsystems, Inc. and the netbeans.org developer community. |
30 Initially just a Java IDE, NetBeans has had C, C++, and Fortran support added | 68 Initially just a Java IDE, NetBeans has had C, C++, and Fortran support added |
31 in recent releases. | 69 in recent releases. |
32 | 70 |
33 For more information visit the main NetBeans web site http://www.netbeans.org | 71 For more information visit the main NetBeans web site http://www.netbeans.org. |
34 or the NetBeans External Editor site at http://externaleditor.netbeans.org. | 72 The External Editor is now, unfortunately, declared Obsolte. See |
73 http://externaleditor.netbeans.org. | |
35 | 74 |
36 Sun Microsystems, Inc. also ships NetBeans under the name Sun ONE Studio. | 75 Sun Microsystems, Inc. also ships NetBeans under the name Sun ONE Studio. |
37 Visit http://www.sun.com for more information regarding the Sun ONE Studio | 76 Visit http://www.sun.com for more information regarding the Sun ONE Studio |
38 product line. | 77 product line. |
39 | 78 |
40 Current releases of NetBeans provide full support for Java and limited support | 79 Current releases of NetBeans provide full support for Java and limited support |
41 for C, C++, and Fortran. Current releases of Sun ONE Studio provide full | 80 for C, C++, and Fortran. Current releases of Sun ONE Studio provide full |
42 support for Java, C, C++, and Fortran. | 81 support for Java, C, C++, and Fortran. |
43 | 82 |
44 The interface to NetBeans is also supported by Agide, the A-A-P GUI IDE. | |
45 Agide is very different from NetBeans: | |
46 - Based on Python instead of Java, much smaller footprint and fast startup. | |
47 - Agide is a framework in which many different tools can work together. | |
48 See the A-A-P website for information: http://www.A-A-P.org. | |
49 | |
50 ============================================================================== | 83 ============================================================================== |
51 2. NetBeans Key Bindings *netbeans-keybindings* | 84 2. Integration features *netbeans-integration* |
52 | 85 |
53 Vim understands a number of key bindings that execute NetBeans commands. | 86 The NetBeans socket interface of Vim allows to get information from Vim or to |
54 These are typically all the Function key combinations. To execute a NetBeans | 87 ask Vim to perform specific actions: |
55 command, the user must press the Pause key followed by a NetBeans key binding. | 88 - get information about buffer: buffer name, cursor position, buffer content, |
56 For example, in order to compile a Java file, the NetBeans key binding is | 89 etc. |
57 "F9". So, while in vim, press "Pause F9" to compile a java file. To toggle a | 90 - be notified when buffers are open or closed |
58 breakpoint at the current line, press "Pause Shift F8". | 91 - be notified of how the buffer content is modified |
59 | 92 - load and save files |
60 The Pause key is Function key 21. If you don't have a working Pause key and | 93 - modify the buffer content |
61 want to use F8 instead, use: > | 94 - installing special key bindings |
62 | 95 - raise the window, control the window geometry |
63 :map <F8> <F21> | 96 |
64 | 97 For sending key strokes to Vim or for evaluating functions in Vim, you must |
65 The External Editor module dynamically reads the NetBeans key bindings so vim | 98 use the |clientserver| interface. |
66 should always have the latest key bindings, even when NetBeans changes them. | 99 |
67 | 100 |
68 ============================================================================== | 101 ============================================================================== |
69 3. Configuring Vim for NetBeans *netbeans-configure* | 102 3. Configuring Vim for NetBeans *netbeans-configure* |
70 | 103 |
71 For more help installing vim, please read |usr_90.txt| in the Vim User Manual. | 104 For more help installing Vim, please read |usr_90.txt| in the Vim User Manual. |
72 | 105 |
73 | 106 |
74 On Unix | 107 On Unix: |
108 -------- | |
75 | 109 |
76 When running configure without arguments the NetBeans interface should be | 110 When running configure without arguments the NetBeans interface should be |
77 included. That is, if the configure check to find out if your system supports | 111 included. That is, if the configure check to find out if your system supports |
78 the required features succeeds. | 112 the required features succeeds. |
79 | 113 |
80 In case you do not want the NetBeans interface you can disable it by | 114 In case you do not want the NetBeans interface you can disable it by |
81 uncommenting a line with "--disable-netbeans" in the Makefile. | 115 uncommenting a line with "--disable-netbeans" in the Makefile. |
82 | 116 |
83 Currently, only gvim is supported in this integration as NetBeans does not | 117 Currently, only GVim is supported in this integration as NetBeans does not |
84 have means to supply a terminal emulator for the vim command. Furthermore, | 118 have means to supply a terminal emulator for the Vim command. Furthermore, |
85 there is only GUI support for GTK, GNOME, and Motif. | 119 there is only GUI support for GTK, GNOME, and Motif. |
86 | 120 |
87 If Motif support is required the user must supply XPM libraries. See | 121 If Motif support is required the user must supply XPM libraries. See |
88 |workshop-xpm| for details on obtaining the latest version of XPM. | 122 |workshop-xpm| for details on obtaining the latest version of XPM. |
89 | 123 |
90 | 124 |
91 On MS-Windows | 125 On MS-Windows: |
126 -------------- | |
92 | 127 |
93 The Win32 support is now in beta stage. | 128 The Win32 support is now in beta stage. |
94 | 129 |
95 To use XPM signs on Win32 (e.g. when using with NetBeans) you can compile | 130 To use XPM signs on Win32 (e.g. when using with NetBeans) you can compile |
96 XPM by yourself or use precompiled libraries from http://iamphet.nm.ru/misc/ | 131 XPM by yourself or use precompiled libraries from http://iamphet.nm.ru/misc/ |
97 (for MS Visual C++) or http://gnuwin32.sourceforge.net (for MinGW). | 132 (for MS Visual C++) or http://gnuwin32.sourceforge.net (for MinGW). |
98 | 133 |
134 Enable debugging: | |
135 ----------------- | |
136 | |
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| | |
141 | |
99 ============================================================================== | 142 ============================================================================== |
100 4. Downloading NetBeans *netbeans-download* | 143 4. Error Messages *netbeans-messages* |
101 | 144 |
102 The NetBeans IDE is available for download from netbeans.org. You can download | 145 These error messages are specific to NetBeans socket protocol: |
103 a released version, download sources, or use CVS to download the current | |
104 source tree. If you choose to download sources, follow directions from | |
105 netbeans.org on building NetBeans. | |
106 | |
107 Depending on the version of NetBeans you download, you may need to do further | |
108 work to get the required External Editor module. This is the module which lets | |
109 NetBeans work with gvim (or xemacs :-). See http://externaleditor.netbeans.org | |
110 for details on downloading this module if your NetBeans release does not have | |
111 it. | |
112 | |
113 For C, C++, and Fortran support you will also need the cpp module. See | |
114 http://cpp.netbeans.org for information regarding this module. | |
115 | |
116 You can also download Sun ONE Studio from Sun Microsystems, Inc for a 30 day | |
117 free trial. See http://www.sun.com for further details. | |
118 | |
119 ============================================================================== | |
120 5. Preparing NetBeans for Vim *netbeans-preparation* | |
121 | |
122 In order for NetBeans to work with vim, the NetBeans External Editor module | |
123 must be loaded and enabled. If you have a Sun ONE Studio Enterprise Edition | |
124 then this module should be loaded and enabled. If you have a NetBeans release | |
125 you may need to find another way of obtaining this open source module. | |
126 | |
127 You can check if you have this module by opening the Tools->Options dialog | |
128 and drilling down to the "Modules" list (IDE Configuration->System->Modules). | |
129 If your Modules list has an entry for "External Editor" you must make sure | |
130 it is enabled (the "Enabled" property should have the value "True"). If your | |
131 Modules list has no External Editor see the next section on |obtaining-exted|. | |
132 | |
133 ============================================================================== | |
134 6. Obtaining the External Editor Module *obtaining-exted* | |
135 | |
136 There are 2 ways of obtaining the External Editor module. The easiest way | |
137 is to use the NetBeans Update Center to download and install the module. | |
138 Unfortunately, some versions do not have this module in their update | |
139 center. If you cannot download via the update center you will need to | |
140 download sources and build the module. I will try and get the module | |
141 available from the NetBeans Update Center so building will be unnecessary. | |
142 Also check http://externaleditor.netbeans.org for other availability options. | |
143 | |
144 To download the External Editor sources via CVS and build your own module, | |
145 see http://externaleditor.netbeans.org and http://www.netbeans.org. | |
146 Unfortunately, this is not a trivial procedure. | |
147 | |
148 ============================================================================== | |
149 7. Setting up NetBeans to run with Vim *netbeans-setup* | |
150 | |
151 Assuming you have loaded and enabled the NetBeans External Editor module | |
152 as described in |netbeans-preparation| all you need to do is verify that | |
153 the gvim command line is properly configured for your environment. | |
154 | |
155 Open the Tools->Options dialog and open the Editing category. Select the | |
156 External Editor. The right hand pane should contain a Properties tab and | |
157 an Expert tab. In the Properties tab make sure the "Editor Type" is set | |
158 to "Vim". In the Expert tab make sure the "Vim Command" is correct. | |
159 | |
160 You should be careful if you change the "Vim Command". There are command | |
161 line options there which must be there for the connection to be properly | |
162 set up. You can change the command name but that's about it. If your gvim | |
163 can be found by your $PATH then the VIM Command can start with "gvim". If | |
164 you don't want gvim searched from your $PATH then hard code in the full | |
165 Unix path name. At this point you should get a gvim for any source file | |
166 you open in NetBeans. | |
167 | |
168 If some files come up in gvim and others (with different file suffixes) come | |
169 up in the default NetBeans editor you should verify the MIME type in the | |
170 Expert tab MIME Type property. NetBeans is MIME oriented and the External | |
171 Editor will only open MIME types specified in this property. | |
172 | |
173 ============================================================================== | |
174 8. Messages *netbeans-messages* | |
175 | |
176 These messages are specific for NetBeans: | |
177 | 146 |
178 *E463* | 147 *E463* |
179 Region is guarded, cannot modify | 148 Region is guarded, cannot modify |
180 NetBeans defines guarded areas in the text, which you cannot | 149 The Vim Controller has defined guarded areas in the text, |
181 change. | 150 which you cannot change. Also sets the current buffer, if |
182 Also sets the current buffer, if necessary. | 151 necessary. |
183 | 152 |
184 *E656* | 153 *E656* |
185 NetBeans disallows writes of unmodified buffers | 154 Writes of unmodified buffers forbidden |
186 NetBeans does not support writes of unmodified buffers that | 155 Writes of unmodified buffers that were opened from the |
187 were opened from NetBeans. | 156 Vim Controller are not possible. |
188 | 157 |
189 *E657* | 158 *E657* |
190 Partial writes disallowed for NetBeans buffers | 159 Partial writes disallowed |
191 NetBeans does not support partial writes for buffers that were | 160 Partial writes for buffers that were opened from the |
192 opened from NetBeans. | 161 Vim Controller are not allowed. |
193 | 162 |
194 *E658* | 163 *E658* |
195 NetBeans connection lost for this buffer | 164 Connection lost for this buffer |
196 NetBeans has become confused about the state of this file. | 165 The Vim Controller has become confused about the state of |
197 Rather than risk data corruption, NetBeans has severed the | 166 this file. Rather than risk data corruption, it has severed |
198 connection for this file. Vim will take over responsibility | 167 the connection for this file. Vim will take over |
199 for saving changes to this file and NetBeans will no longer | 168 responsibility for saving changes to this file and the |
200 know of these changes. | 169 Vim Controller will no longer know of these changes. |
201 | 170 |
202 *E744* | 171 *E744* |
203 NetBeans does not allow changes in read-only files | 172 Read-only file |
204 Vim normally allows changes to a read-only file and only | 173 Vim normally allows changes to a read-only file and only |
205 enforces the read-only rule if you try to write the file. | 174 enforces the read-only rule if you try to write the file. |
206 However, NetBeans does not let you make changes to a file | 175 However, NetBeans does not let you make changes to a file |
207 which is read-only and becomes confused if vim does this. | 176 which is read-only and becomes confused if Vim does this. |
208 So vim does not allow modifications to files when run with | 177 So Vim does not allow modifications to files when run |
209 NetBeans. | 178 in NetBeans mode. |
179 | |
210 ============================================================================== | 180 ============================================================================== |
211 9. Running Vim from NetBeans *netbeans-run* | 181 5. Running Vim in NetBeans mode *netbeans-run* |
212 | 182 |
213 NetBeans starts Vim with the |-nb| argument. Three forms can be used, that | 183 Vim must be started with the |-nb| argument. Three forms can be used, that |
214 differ in the way the information for the connection is specified: | 184 differ in the way the information for the connection is specified: |
215 | 185 |
216 -nb={fname} from a file | 186 -nb={fname} from a file |
217 -nb:{hostname}:{addr}:{password} directly | 187 -nb:{hostname}:{addr}:{password} directly |
218 -nb from a file or environment | 188 -nb from a file or environment |
229 auth={password} | 199 auth={password} |
230 | 200 |
231 Other lines are ignored. The caller of Vim is responsible for deleting the | 201 Other lines are ignored. The caller of Vim is responsible for deleting the |
232 file afterwards. | 202 file afterwards. |
233 | 203 |
234 {hostname} is the name of the machine where NetBeans is running. When omitted | 204 {hostname} is the name of the machine where Vim Controller is running. When |
235 the environment variable "__NETBEANS_HOST" is used or the default "localhost". | 205 omitted the environment variable "__NETBEANS_HOST" is used or the default |
236 | 206 "localhost". |
237 {addr} is the port number for NetBeans. When omitted the environment variable | 207 |
238 "__NETBEANS_SOCKET" is used or the default 3219. | 208 {addr} is the port number for the NetBeans interface. When omitted the |
209 environment variable "__NETBEANS_SOCKET" is used or the default 3219. | |
239 | 210 |
240 {password} is the password for connecting to NetBeans. When omitted the | 211 {password} is the password for connecting to NetBeans. When omitted the |
241 environment variable "__NETBEANS_VIM_PASSWORD" is used or "changeme". | 212 environment variable "__NETBEANS_VIM_PASSWORD" is used or "changeme". |
242 | 213 |
214 Vim will initiate a socket connection (client side) to the specified host and | |
215 port upon startup. The password will be sent with the AUTH event when the | |
216 connection has been established. | |
217 | |
218 | |
243 ============================================================================== | 219 ============================================================================== |
244 10. NetBeans protocol *netbeans-protocol* | 220 6. NetBeans protocol *netbeans-protocol* |
245 | 221 |
246 The communication between NetBeans and Vim uses plain text messages. This | 222 The communication between the Vim Controller and Vim uses plain text |
247 protocol was first designed to work with the external editor module of | 223 messages. This protocol was first designed to work with the external editor |
248 NetBeans (see http://externaleditor.netbeans.org). Later it was extended to | 224 module of NetBeans. Later it was extended to work with Agide (A-A-P GUI IDE, |
249 work with Agide (A-A-P GUI IDE, see http://www.a-a-p.org). The extensions are | 225 see http://www.a-a-p.org) and then with other IDE. The extensions are marked |
250 marked with "version 2.1". | 226 with "version 2.1". |
251 | 227 |
252 Version 2.2 of the protocol has several minor changes which should only affect | 228 Version 2.2 of the protocol has several minor changes which should only affect |
253 NetBeans users (ie, not Agide users). However, a bug was fixed which could | 229 NetBeans users (ie, not Agide users). However, a bug was fixed which could |
254 cause confusion. The netbeans_saved() function sent a "save" protocol | 230 cause confusion. The netbeans_saved() function sent a "save" protocol |
255 command. In protocol version 2.1 and earlier this was incorrectly interpreted | 231 command. In protocol version 2.1 and earlier this was incorrectly interpreted |
264 | 240 |
265 The messages are currently sent over a socket. Since the messages are in | 241 The messages are currently sent over a socket. Since the messages are in |
266 plain UTF-8 text this protocol could also be used with any other communication | 242 plain UTF-8 text this protocol could also be used with any other communication |
267 mechanism. | 243 mechanism. |
268 | 244 |
269 To see an example implementation look at the gvim tool in Agide. Currently | 245 6.1 Kinds of messages |nb-messages| |
270 found here: | 246 6.2 Terms |nb-terms| |
271 http://cvs.sf.net/viewcvs.py/a-a-p/Agide/Tools/GvimTool.py?view=markup | 247 6.3 Commands |nb-commands| |
272 | 248 6.4 Functions and Replies |nb-functions| |
273 | 249 6.5 Events |nb-events| |
274 | 250 6.6 Special messages |nb-special| |
275 10.1 Kinds of messages |nb-messages| | 251 6.7 Protocol errors |nb-protocol_errors| |
276 10.2 Terms |nb-terms| | 252 |
277 10.3 Commands |nb-commands| | 253 |
278 10.4 Functions and Replies |nb-functions| | 254 6.1 Kinds of messages *nb-messages* |
279 10.5 Events |nb-events| | |
280 10.6 Special messages |nb-special| | |
281 | |
282 *E627* *E628* *E629* *E630* *E631* *E632* *E633* *E634* *E635* *E636* | |
283 *E637* *E638* *E639* *E640* *E641* *E642* *E643* *E644* *E645* *E646* | |
284 *E647* *E648* *E649* *E650* *E651* *E652* *E653* *E654* | |
285 These errors occur when a message violates the protocol. | |
286 | |
287 | |
288 10.1 Kinds of messages *nb-messages* | |
289 | 255 |
290 There are four kinds of messages: | 256 There are four kinds of messages: |
291 | 257 |
292 kind direction comment ~ | 258 kind direction comment ~ |
293 Command IDE -> editor no reply necessary | 259 Command IDE -> editor no reply necessary |
301 | 267 |
302 kind first item example ~ | 268 kind first item example ~ |
303 Command bufID:name!seqno 11:showBalloon!123 "text" | 269 Command bufID:name!seqno 11:showBalloon!123 "text" |
304 Function bufID:name/seqno 11:getLength/123 | 270 Function bufID:name/seqno 11:getLength/123 |
305 Reply seqno 123 5000 | 271 Reply seqno 123 5000 |
306 Event bufID:name=123 11:keyCommand=123 "S-F2" | 272 Event bufID:name=seqno 11:keyCommand=123 "S-F2" |
307 | 273 |
308 | 274 |
309 10.2 Terms *nb-terms* | 275 |
276 6.2 Terms *nb-terms* | |
310 | 277 |
311 bufID Buffer number. A message may be either for a specific buffer | 278 bufID Buffer number. A message may be either for a specific buffer |
312 or generic. Generic messages use a bufID of zero. NOTE: this | 279 or generic. Generic messages use a bufID of zero. NOTE: this |
313 buffer ID is assigned by the IDE, it is not Vim's buffer | 280 buffer ID is assigned by the IDE, it is not Vim's buffer |
314 number. The bufID must be a sequentially rising number, | 281 number. The bufID must be a sequentially rising number, |
351 for several columns. | 318 for several columns. |
352 | 319 |
353 pathname String argument: file name with full path. | 320 pathname String argument: file name with full path. |
354 | 321 |
355 | 322 |
356 10.3 Commands *nb-commands* | 323 6.3 Commands *nb-commands* |
357 | 324 |
358 actionMenuItem Not implemented. | 325 actionMenuItem Not implemented. |
359 | 326 |
360 actionSensitivity | 327 actionSensitivity |
361 Not implemented. | 328 Not implemented. |
379 close Close the buffer. This leaves us without current buffer, very | 346 close Close the buffer. This leaves us without current buffer, very |
380 dangerous to use! | 347 dangerous to use! |
381 | 348 |
382 create Creates a buffer without a name. Replaces the current buffer | 349 create Creates a buffer without a name. Replaces the current buffer |
383 (it's hidden when it was changed). | 350 (it's hidden when it was changed). |
384 NetBeans uses this as the first command for a file that is | 351 The Vim Controller should use this as the first command for a |
385 being opened. The sequence of commands could be: | 352 file that is being opened. The sequence of commands could be: |
386 create | 353 create |
387 setCaretListener (ignored) | 354 setCaretListener (ignored) |
388 setModified (no effect) | 355 setModified (no effect) |
389 setContentType (ignored) | 356 setContentType (ignored) |
390 startDocumentListen | 357 startDocumentListen |
411 sequence number is later used with addAnno. | 378 sequence number is later used with addAnno. |
412 | 379 |
413 editFile pathname | 380 editFile pathname |
414 Set the name for the buffer and edit the file "pathname", a | 381 Set the name for the buffer and edit the file "pathname", a |
415 string argument. | 382 string argument. |
416 Normal way for the IDE to tell the editor to edit a file. If | 383 Normal way for the IDE to tell the editor to edit a file. |
417 the IDE is going to pass the file text to the editor use these | 384 |
418 commands instead: | 385 You must set a bufId different of 0 with this command to |
386 assign a bufId to the buffer. It will trigger an event | |
387 fileOpened with a bufId of 0 but the buffer has been assigned. | |
388 | |
389 If the IDE is going to pass the file text to the editor use | |
390 these commands instead: | |
419 setFullName | 391 setFullName |
420 insert | 392 insert |
421 initDone | 393 initDone |
422 New in version 2.1. | 394 New in version 2.1. |
423 | 395 |
435 | 407 |
436 initDone Mark the buffer as ready for use. Implicitly makes the buffer | 408 initDone Mark the buffer as ready for use. Implicitly makes the buffer |
437 the current buffer. Fires the BufReadPost autocommand event. | 409 the current buffer. Fires the BufReadPost autocommand event. |
438 | 410 |
439 insertDone | 411 insertDone |
440 Sent by NetBeans to tell vim an initial file insert is done. | 412 Sent by Vim Controller to tell Vim an initial file insert is |
441 This triggers a read message being printed. Prior to version | 413 done. This triggers a read message being printed. Prior to |
442 2.3, no read messages were displayed after opening a file. | 414 version 2.3, no read messages were displayed after opening a |
443 New in version 2.3. | 415 file. New in version 2.3. |
444 | 416 |
445 moveAnnoToFront serNum | 417 moveAnnoToFront serNum |
446 Not implemented. | 418 Not implemented. |
447 | 419 |
448 netbeansBuffer isNetbeansBuffer | 420 netbeansBuffer isNetbeansBuffer |
474 - the buffer does not have a file name | 446 - the buffer does not have a file name |
475 - 'buftype' disallows writing | 447 - 'buftype' disallows writing |
476 New in version 2.2. | 448 New in version 2.2. |
477 | 449 |
478 saveDone | 450 saveDone |
479 Sent by NetBeans to tell vim a save is done. This triggers | 451 Sent by Vim Controller to tell Vim a save is done. This |
480 a save message being printed. Prior to version 2.3, no save | 452 triggers a save message being printed. Prior to version 2.3, |
481 messages were displayed after a save. | 453 no save messages were displayed after a save. |
482 New in version 2.3. | 454 New in version 2.3. |
483 | 455 |
484 setAsUser Not implemented. | 456 setAsUser Not implemented. |
485 | 457 |
486 setBufferNumber pathname | 458 setBufferNumber pathname |
523 setModified modified | 495 setModified modified |
524 When the boolean argument "modified" is "T" mark the buffer as | 496 When the boolean argument "modified" is "T" mark the buffer as |
525 modified, when it is "F" mark it as unmodified. | 497 modified, when it is "F" mark it as unmodified. |
526 | 498 |
527 setModtime time | 499 setModtime time |
528 Update a buffers modification time after NetBeans saves the | 500 Update a buffers modification time after the file has been |
529 file. | 501 saved directly by the Vim Controller. |
530 New in version 2.3. | 502 New in version 2.3. |
531 | 503 |
532 setReadOnly | 504 setReadOnly |
533 Passed by NetBeans to tell vim a file is readonly. | 505 Set a file as readonly |
534 Implemented in verion 2.3. | 506 Implemented in version 2.3. |
535 | 507 |
536 setStyle Not implemented. | 508 setStyle Not implemented. |
537 | 509 |
538 setTitle name | 510 setTitle name |
539 Set the title for the buffer to "name", a string argument. | 511 Set the title for the buffer to "name", a string argument. |
540 The title is only used for NetBeans functions, not by Vim. | 512 The title is only used for the Vim Controller functions, not |
513 by Vim. | |
541 | 514 |
542 setVisible visible | 515 setVisible visible |
543 When the boolean argument "visible" is "T", goto the buffer. | 516 When the boolean argument "visible" is "T", goto the buffer. |
544 The "F" argument does nothing. | 517 The "F" argument does nothing. |
545 | 518 |
549 disappear when the mouse is moved more than a few pixels. | 522 disappear when the mouse is moved more than a few pixels. |
550 New in version 2.1. | 523 New in version 2.1. |
551 | 524 |
552 specialKeys | 525 specialKeys |
553 Map a set of keys (mostly function keys) to be passed back | 526 Map a set of keys (mostly function keys) to be passed back |
554 to NetBeans for processing. This lets NetBeans hotkeys be | 527 to the Vim Controller for processing. This lets regular IDE |
555 used from vim. | 528 hotkeys be used from Vim. |
556 Implemented in version 2.3. | 529 Implemented in version 2.3. |
557 | 530 |
558 startAtomic Begin an atomic operation. The screen will not be updated | 531 startAtomic Begin an atomic operation. The screen will not be updated |
559 until "endAtomic" is given. | 532 until "endAtomic" is given. |
560 | 533 |
581 Also sets the current buffer, if necessary. | 554 Also sets the current buffer, if necessary. |
582 | 555 |
583 version Not implemented. | 556 version Not implemented. |
584 | 557 |
585 | 558 |
586 10.4 Functions and Replies *nb-functions* | 559 6.4 Functions and Replies *nb-functions* |
587 | 560 |
588 getDot Not implemented. | 561 getDot Not implemented. |
589 | 562 |
590 getCursor Return the current buffer and cursor position. | 563 getCursor Return the current buffer and cursor position. |
591 The reply is: | 564 The reply is: |
628 not implemented. | 601 not implemented. |
629 | 602 |
630 insert off text | 603 insert off text |
631 Insert "text" before position "off". "text" is a string | 604 Insert "text" before position "off". "text" is a string |
632 argument, "off" a number. | 605 argument, "off" a number. |
633 "off" should have a "\n" (newline) at the end of each line. | 606 "text" should have a "\n" (newline) at the end of each line. |
634 Or "\r\n" when 'fileformat' is "dos". When using "insert" in | 607 Or "\r\n" when 'fileformat' is "dos". When using "insert" in |
635 an empty buffer Vim will set 'fileformat' accordingly. | 608 an empty buffer Vim will set 'fileformat' accordingly. |
636 When "off" points to the start of a line the text is inserted | 609 When "off" points to the start of a line the text is inserted |
637 above this line. Thus when "off" is zero lines are inserted | 610 above this line. Thus when "off" is zero lines are inserted |
638 before the first line. | 611 before the first line. |
663 If the user cancels the operation the number of modified | 636 If the user cancels the operation the number of modified |
664 buffers that remains is returned and Vim does not exit. | 637 buffers that remains is returned and Vim does not exit. |
665 New in version 2.1. | 638 New in version 2.1. |
666 | 639 |
667 | 640 |
668 10.5 Events *nb-events* | 641 6.5 Events *nb-events* |
669 | 642 |
670 balloonEval off len type | 643 balloonEval off len type |
671 The mouse pointer rests on text for a short while. When "len" | 644 The mouse pointer rests on text for a short while. When "len" |
672 is zero, there is no selection and the pointer is at position | 645 is zero, there is no selection and the pointer is at position |
673 "off". When "len" is non-zero the text from position "off" to | 646 "off". When "len" is non-zero the text from position "off" to |
683 New in version 2.1. | 656 New in version 2.1. |
684 | 657 |
685 buttonRelease button lnum col | 658 buttonRelease button lnum col |
686 Report which button was pressed and the location of the cursor | 659 Report which button was pressed and the location of the cursor |
687 at the time of the release. Only for buffers that are owned | 660 at the time of the release. Only for buffers that are owned |
688 by NetBeans. This event is not sent if the button was | 661 by the Vim Controller. This event is not sent if the button |
689 released while the mouse was in the status line or in a | 662 was released while the mouse was in the status line or in a |
690 separator line. If col is less than 1 the button release was | 663 separator line. If col is less than 1 the button release was |
691 in the sign area. | 664 in the sign area. |
692 New in version 2.2. | 665 New in version 2.2. |
693 | 666 |
694 disconnect | 667 disconnect |
695 Tell NetBeans that vim is exiting and not to try and read or | 668 Tell the Vim Controller that Vim is exiting and not to try and |
696 write more commands. | 669 read or write more commands. |
697 New in version 2.3. | 670 New in version 2.3. |
698 | 671 |
699 fileClosed Not implemented. | 672 fileClosed Not implemented. |
700 | 673 |
701 fileModified Not implemented. | 674 fileModified Not implemented. |
774 | 747 |
775 unmodified The buffer is now unmodified. | 748 unmodified The buffer is now unmodified. |
776 Only fired when enabled, see "startDocumentListen". | 749 Only fired when enabled, see "startDocumentListen". |
777 | 750 |
778 version vers Report the version of the interface implementation. Vim | 751 version vers Report the version of the interface implementation. Vim |
779 reports "2.2" (including the quotes). | 752 reports "2.4" (including the quotes). |
780 | 753 |
781 | 754 |
782 10.6 Special messages *nb-special* | 755 6.6 Special messages *nb-special* |
783 | 756 |
784 These messages do not follow the style of the messages above. They are | 757 These messages do not follow the style of the messages above. They are |
785 terminated by a newline character. | 758 terminated by a newline character. |
786 | 759 |
787 ACCEPT Not used. | 760 ACCEPT Not used. |
799 editor as well. | 772 editor as well. |
800 New in version 2.1. | 773 New in version 2.1. |
801 | 774 |
802 REJECT Not used. | 775 REJECT Not used. |
803 | 776 |
777 | |
778 6.7 Protocol errors *nb-protocol_errors* | |
779 | |
780 These errors occur when a message violates the protocol: | |
781 *E627* *E628* *E629* *E630* *E631* *E632* *E633* *E634* *E635* *E636* | |
782 *E637* *E638* *E639* *E640* *E641* *E642* *E643* *E644* *E645* *E646* | |
783 *E647* *E648* *E649* *E650* *E651* *E652* *E653* *E654* | |
784 | |
785 | |
804 ============================================================================== | 786 ============================================================================== |
805 11. NetBeans Commands *netbeans-commands* | 787 7. NetBeans key *netbeans-key* |
806 | 788 |
807 *:nbkey* | 789 *:nbkey* |
808 :nbkey key Pass the key to NetBeans for processing | 790 :nbkey key Pass the key to the Vim Controller for processing |
809 | 791 |
810 Pass the key to NetBeans for hot-key processing. You should not need to use | 792 When a hot-key has been installed with the specialKeys command, this command |
811 this command directly. However, NetBeans passes a list of hot-keys to Vim at | 793 can be used to generate a hotkey messages to the Vim Controller. The events |
812 startup and when one of these keys is pressed, this command is generated to | 794 newDotAndMark, keyCommand and keyAtPos are generated (in this order). |
813 send the key press back to NetBeans. | 795 |
814 | 796 |
815 ============================================================================== | 797 ============================================================================== |
816 12. Known problems *netbeans-problems* | 798 8. Known problems *netbeans-problems* |
817 | 799 |
818 NUL bytes are not possible. For editor -> IDE they will appear as NL | 800 NUL bytes are not possible. For editor -> IDE they will appear as NL |
819 characters. For IDE -> editor they cannot be inserted. | 801 characters. For IDE -> editor they cannot be inserted. |
820 | 802 |
821 | 803 |
804 ============================================================================== | |
805 9. Debugging NetBeans protocol *netbeans-debugging* | |
806 | |
807 To debug the Vim protocol, you must first compile Vim with debugging support | |
808 and NetBeans debugging support. See |netbeans-configure| for instructions | |
809 about Vim compiling and how to enable debug support. | |
810 | |
811 When running Vim, set the following environment variables: | |
812 | |
813 export SPRO_GVIM_DEBUG=netbeans.log | |
814 export SPRO_GVIM_DLEVEL=0xffffffff | |
815 | |
816 Vim will then log all the incoming and outgoing messages of the NetBeans | |
817 protocol to the file netbeans.log . | |
818 | |
819 The content of netbeans.log after a session looks like this: | |
820 Tue May 20 17:19:27 2008 | |
821 EVT: 0:startupDone=0 | |
822 CMD 1: (1) create | |
823 CMD 2: (1) setTitle "testfile1.txt" | |
824 CMD 3: (1) setFullName "testfile1.txt" | |
825 EVT(suppressed): 1:remove=3 0 -1 | |
826 EVT: 1:fileOpened=0 "d:\\work\\vimWrapper\\vimWrapper2\\pyvimwrapper\\tests\\testfile1.txt" T F | |
827 CMD 4: (1) initDone | |
828 FUN 5: (0) getCursor | |
829 REP 5: 1 1 0 0 | |
830 CMD 6: (2) create | |
831 CMD 7: (2) setTitle "testfile2.txt" | |
832 CMD 8: (2) setFullName "testfile2.txt" | |
833 EVT(suppressed): 2:remove=8 0 -1 | |
834 EVT: 2:fileOpened=0 "d:\\work\\vimWrapper\\vimWrapper2\\pyvimwrapper\\tests\\testfile2.txt" T F | |
835 CMD 9: (2) initDone | |
836 | |
837 | |
838 ============================================================================== | |
839 10. NetBeans External Editor | |
840 | |
841 NOTE: This information is obsolete! Only relevant if you are using an old | |
842 version of NetBeans. | |
843 | |
844 | |
845 10.1. Downloading NetBeans *netbeans-download* | |
846 | |
847 The NetBeans IDE is available for download from netbeans.org. You can download | |
848 a released version, download sources, or use CVS to download the current | |
849 source tree. If you choose to download sources, follow directions from | |
850 netbeans.org on building NetBeans. | |
851 | |
852 Depending on the version of NetBeans you download, you may need to do further | |
853 work to get the required External Editor module. This is the module which lets | |
854 NetBeans work with gvim (or xemacs :-). See http://externaleditor.netbeans.org | |
855 for details on downloading this module if your NetBeans release does not have | |
856 it. | |
857 | |
858 For C, C++, and Fortran support you will also need the cpp module. See | |
859 http://cpp.netbeans.org for information regarding this module. | |
860 | |
861 You can also download Sun ONE Studio from Sun Microsystems, Inc for a 30 day | |
862 free trial. See http://www.sun.com for further details. | |
863 | |
864 | |
865 10.2. NetBeans Key Bindings *netbeans-keybindings* | |
866 | |
867 Vim understands a number of key bindings that execute NetBeans commands. | |
868 These are typically all the Function key combinations. To execute a NetBeans | |
869 command, the user must press the Pause key followed by a NetBeans key binding. | |
870 For example, in order to compile a Java file, the NetBeans key binding is | |
871 "F9". So, while in vim, press "Pause F9" to compile a java file. To toggle a | |
872 breakpoint at the current line, press "Pause Shift F8". | |
873 | |
874 The Pause key is Function key 21. If you don't have a working Pause key and | |
875 want to use F8 instead, use: > | |
876 | |
877 :map <F8> <F21> | |
878 | |
879 The External Editor module dynamically reads the NetBeans key bindings so vim | |
880 should always have the latest key bindings, even when NetBeans changes them. | |
881 | |
882 | |
883 10.3. Preparing NetBeans for Vim *netbeans-preparation* | |
884 | |
885 In order for NetBeans to work with vim, the NetBeans External Editor module | |
886 must be loaded and enabled. If you have a Sun ONE Studio Enterprise Edition | |
887 then this module should be loaded and enabled. If you have a NetBeans release | |
888 you may need to find another way of obtaining this open source module. | |
889 | |
890 You can check if you have this module by opening the Tools->Options dialog | |
891 and drilling down to the "Modules" list (IDE Configuration->System->Modules). | |
892 If your Modules list has an entry for "External Editor" you must make sure | |
893 it is enabled (the "Enabled" property should have the value "True"). If your | |
894 Modules list has no External Editor see the next section on |obtaining-exted|. | |
895 | |
896 | |
897 10.4. Obtaining the External Editor Module *obtaining-exted* | |
898 | |
899 There are 2 ways of obtaining the External Editor module. The easiest way | |
900 is to use the NetBeans Update Center to download and install the module. | |
901 Unfortunately, some versions do not have this module in their update | |
902 center. If you cannot download via the update center you will need to | |
903 download sources and build the module. I will try and get the module | |
904 available from the NetBeans Update Center so building will be unnecessary. | |
905 Also check http://externaleditor.netbeans.org for other availability options. | |
906 | |
907 To download the External Editor sources via CVS and build your own module, | |
908 see http://externaleditor.netbeans.org and http://www.netbeans.org. | |
909 Unfortunately, this is not a trivial procedure. | |
910 | |
911 | |
912 10.5. Setting up NetBeans to run with Vim *netbeans-setup* | |
913 | |
914 Assuming you have loaded and enabled the NetBeans External Editor module | |
915 as described in |netbeans-preparation| all you need to do is verify that | |
916 the gvim command line is properly configured for your environment. | |
917 | |
918 Open the Tools->Options dialog and open the Editing category. Select the | |
919 External Editor. The right hand pane should contain a Properties tab and | |
920 an Expert tab. In the Properties tab make sure the "Editor Type" is set | |
921 to "Vim". In the Expert tab make sure the "Vim Command" is correct. | |
922 | |
923 You should be careful if you change the "Vim Command". There are command | |
924 line options there which must be there for the connection to be properly | |
925 set up. You can change the command name but that's about it. If your gvim | |
926 can be found by your $PATH then the VIM Command can start with "gvim". If | |
927 you don't want gvim searched from your $PATH then hard code in the full | |
928 Unix path name. At this point you should get a gvim for any source file | |
929 you open in NetBeans. | |
930 | |
931 If some files come up in gvim and others (with different file suffixes) come | |
932 up in the default NetBeans editor you should verify the MIME type in the | |
933 Expert tab MIME Type property. NetBeans is MIME oriented and the External | |
934 Editor will only open MIME types specified in this property. | |
935 | |
936 | |
822 vim:tw=78:ts=8:ft=help:norl: | 937 vim:tw=78:ts=8:ft=help:norl: |