Bram Moolenaar | ed39e1d | 2008-08-09 17:55:22 +0000 | [diff] [blame] | 1 | *netbeans.txt* For Vim version 7.2. Last change: 2008 Jun 28 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2 | |
| 3 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 4 | VIM REFERENCE MANUAL by Gordon Prieur et al. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 5 | |
| 6 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 7 | *socket-interface* *netbeans* *netbeans-support* |
| 8 | |
| 9 | Vim NetBeans Protocol: a socket interface for Vim integration into an IDE. |
| 10 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 11 | 1. Introduction |netbeans-intro| |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 12 | 2. Integration features |netbeans-integration| |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 13 | 3. Configuring Vim for NetBeans |netbeans-configure| |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 14 | 4. Error Messages |netbeans-messages| |
| 15 | 5. Running Vim in NetBeans mode |netbeans-run| |
| 16 | 6. NetBeans protocol |netbeans-protocol| |
| 17 | 7. NetBeans key |netbeans-key| |
| 18 | 8. Known problems |netbeans-problems| |
| 19 | 9. Debugging NetBeans protocol |netbeans-debugging| |
| 20 | 10. NetBeans External Editor |
| 21 | 10.1. Downloading NetBeans |netbeans-download| |
| 22 | 10.2. NetBeans Key Bindings |netbeans-keybindings| |
| 23 | 10.3. Preparing NetBeans for Vim |netbeans-preparation| |
| 24 | 10.4. Obtaining the External Editor Module |obtaining-exted| |
| 25 | 10.5. Setting up NetBeans to run with Vim |netbeans-setup| |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 33 | The NetBeans interface was initially developed to integrate Vim into the |
| 34 | NetBeans Java IDE, using the external editor plugin. This NetBeans plugin no |
| 35 | longer exists for recent versions of NetBeans but the protocol was developed |
| 36 | in such a way that any IDE can use it to integrate Vim. |
| 37 | |
| 38 | The NetBeans protocol of Vim is a text based communication protocol, over a |
| 39 | classical TCP socket. There is no dependency on Java or NetBeans. Any language |
| 40 | or environment providing a socket interface can control Vim using this |
| 41 | protocol. There are existing implementations in C, C++, Python and Java. The |
| 42 | name NetBeans is kept today for historical reasons. |
| 43 | |
| 44 | Current projects using the NetBeans protocol of Vim are: |
| 45 | - VimIntegration, description of various projects doing Vim Integration: |
| 46 | http://www.freehackers.org/VimIntegration |
| 47 | - Agide, an IDE for the AAP project, written in Python: |
| 48 | http://www.a-a-p.org |
| 49 | - Clewn, a gdb integration into Vim, written in C: |
| 50 | http://clewn.sourceforge.net/ |
| 51 | - VimPlugin, integration of Vim inside Eclipse: |
| 52 | http://vimplugin.sourceforge.net/wiki/pmwiki.php |
| 53 | - PIDA, IDE written in Python integrating Vim: |
| 54 | http://pida.co.uk/ |
| 55 | - VimWrapper, library to easy Vim integration into IDE: |
| 56 | http://www.freehackers.org/VimWrapper |
| 57 | |
| 58 | Check the specific project pages to see how to use Vim with these projects. |
| 59 | |
| 60 | In the rest of this help page, we will use the term "Vim Controller" to |
| 61 | describe the program controlling Vim through the NetBeans socket interface. |
| 62 | |
| 63 | |
| 64 | About the NetBeans IDE ~ |
| 65 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 66 | NetBeans is an open source Integrated Development Environment developed |
| 67 | jointly by Sun Microsystems, Inc. and the netbeans.org developer community. |
| 68 | Initially just a Java IDE, NetBeans has had C, C++, and Fortran support added |
| 69 | in recent releases. |
| 70 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 71 | For more information visit the main NetBeans web site http://www.netbeans.org. |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 72 | The External Editor is now, unfortunately, declared obsolete. See |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 73 | http://externaleditor.netbeans.org. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 74 | |
| 75 | Sun Microsystems, Inc. also ships NetBeans under the name Sun ONE Studio. |
| 76 | Visit http://www.sun.com for more information regarding the Sun ONE Studio |
| 77 | product line. |
| 78 | |
| 79 | Current releases of NetBeans provide full support for Java and limited support |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 80 | for C, C++, and Fortran. Current releases of Sun ONE Studio provide full |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 81 | support for Java, C, C++, and Fortran. |
| 82 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 83 | ============================================================================== |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 84 | 2. Integration features *netbeans-integration* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 85 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 86 | The NetBeans socket interface of Vim allows to get information from Vim or to |
| 87 | ask Vim to perform specific actions: |
| 88 | - get information about buffer: buffer name, cursor position, buffer content, |
| 89 | etc. |
| 90 | - be notified when buffers are open or closed |
| 91 | - be notified of how the buffer content is modified |
| 92 | - load and save files |
| 93 | - modify the buffer content |
| 94 | - installing special key bindings |
| 95 | - raise the window, control the window geometry |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 96 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 97 | For sending key strokes to Vim or for evaluating functions in Vim, you must |
| 98 | use the |clientserver| interface. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 99 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 100 | |
| 101 | ============================================================================== |
| 102 | 3. Configuring Vim for NetBeans *netbeans-configure* |
| 103 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 104 | For more help installing Vim, please read |usr_90.txt| in the Vim User Manual. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 105 | |
| 106 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 107 | On Unix: |
| 108 | -------- |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 109 | |
| 110 | When running configure without arguments the NetBeans interface should be |
| 111 | included. That is, if the configure check to find out if your system supports |
| 112 | the required features succeeds. |
| 113 | |
| 114 | In case you do not want the NetBeans interface you can disable it by |
| 115 | uncommenting a line with "--disable-netbeans" in the Makefile. |
| 116 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 117 | Currently, only GVim is supported in this integration as NetBeans does not |
| 118 | have means to supply a terminal emulator for the Vim command. Furthermore, |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 119 | there is only GUI support for GTK, GNOME, and Motif. |
| 120 | |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 121 | If Motif support is required the user must supply XPM libraries. See |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 122 | |workshop-xpm| for details on obtaining the latest version of XPM. |
| 123 | |
| 124 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 125 | On MS-Windows: |
| 126 | -------------- |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 127 | |
| 128 | The Win32 support is now in beta stage. |
| 129 | |
| 130 | To use XPM signs on Win32 (e.g. when using with NetBeans) you can compile |
| 131 | XPM by yourself or use precompiled libraries from http://iamphet.nm.ru/misc/ |
| 132 | (for MS Visual C++) or http://gnuwin32.sourceforge.net (for MinGW). |
| 133 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 134 | Enable debugging: |
| 135 | ----------------- |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 136 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 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| |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 141 | |
| 142 | ============================================================================== |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 143 | 4. Error Messages *netbeans-messages* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 144 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 145 | These error messages are specific to NetBeans socket protocol: |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 146 | |
| 147 | *E463* |
| 148 | Region is guarded, cannot modify |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 149 | The Vim Controller has defined guarded areas in the text, |
| 150 | which you cannot change. Also sets the current buffer, if |
| 151 | necessary. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 152 | |
| 153 | *E656* |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 154 | Writes of unmodified buffers forbidden |
| 155 | Writes of unmodified buffers that were opened from the |
| 156 | Vim Controller are not possible. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 157 | |
| 158 | *E657* |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 159 | Partial writes disallowed |
| 160 | Partial writes for buffers that were opened from the |
| 161 | Vim Controller are not allowed. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 162 | |
| 163 | *E658* |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 164 | Connection lost for this buffer |
| 165 | The Vim Controller has become confused about the state of |
| 166 | this file. Rather than risk data corruption, it has severed |
| 167 | the connection for this file. Vim will take over |
| 168 | responsibility for saving changes to this file and the |
| 169 | Vim Controller will no longer know of these changes. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 170 | |
Bram Moolenaar | 65c1b01 | 2005-01-31 19:02:28 +0000 | [diff] [blame] | 171 | *E744* |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 172 | Read-only file |
Bram Moolenaar | 65c1b01 | 2005-01-31 19:02:28 +0000 | [diff] [blame] | 173 | Vim normally allows changes to a read-only file and only |
| 174 | enforces the read-only rule if you try to write the file. |
| 175 | However, NetBeans does not let you make changes to a file |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 176 | which is read-only and becomes confused if Vim does this. |
| 177 | So Vim does not allow modifications to files when run |
| 178 | in NetBeans mode. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 179 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 180 | ============================================================================== |
| 181 | 5. Running Vim in NetBeans mode *netbeans-run* |
| 182 | |
| 183 | Vim must be started with the |-nb| argument. Three forms can be used, that |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 184 | differ in the way the information for the connection is specified: |
| 185 | |
| 186 | -nb={fname} from a file |
| 187 | -nb:{hostname}:{addr}:{password} directly |
| 188 | -nb from a file or environment |
| 189 | |
| 190 | *E660* *E668* |
| 191 | For security reasons, the best method is to write the information in a file |
| 192 | readable only by the user. The name of the file can be passed with the |
| 193 | "-nb={fname}" argument or, when "-nb" is used without a parameter, the |
| 194 | environment variable "__NETBEANS_CONINFO". The file must contain these three |
| 195 | lines, in any order: |
| 196 | |
| 197 | host={hostname} |
| 198 | port={addr} |
| 199 | auth={password} |
| 200 | |
| 201 | Other lines are ignored. The caller of Vim is responsible for deleting the |
| 202 | file afterwards. |
| 203 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 204 | {hostname} is the name of the machine where Vim Controller is running. When |
| 205 | omitted the environment variable "__NETBEANS_HOST" is used or the default |
| 206 | "localhost". |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 207 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 208 | {addr} is the port number for the NetBeans interface. When omitted the |
| 209 | environment variable "__NETBEANS_SOCKET" is used or the default 3219. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 210 | |
| 211 | {password} is the password for connecting to NetBeans. When omitted the |
| 212 | environment variable "__NETBEANS_VIM_PASSWORD" is used or "changeme". |
| 213 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 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. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 217 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 218 | |
| 219 | ============================================================================== |
| 220 | 6. NetBeans protocol *netbeans-protocol* |
| 221 | |
| 222 | The communication between the Vim Controller and Vim uses plain text |
| 223 | messages. This protocol was first designed to work with the external editor |
| 224 | module of NetBeans. Later it was extended to work with Agide (A-A-P GUI IDE, |
| 225 | see http://www.a-a-p.org) and then with other IDE. The extensions are marked |
| 226 | with "version 2.1". |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 227 | |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 228 | Version 2.2 of the protocol has several minor changes which should only affect |
| 229 | NetBeans users (ie, not Agide users). However, a bug was fixed which could |
| 230 | cause confusion. The netbeans_saved() function sent a "save" protocol |
| 231 | command. In protocol version 2.1 and earlier this was incorrectly interpreted |
| 232 | as a notification that a write had taken place. In reality, it told NetBeans |
| 233 | to save the file so multiple writes were being done. This caused various |
| 234 | problems and has been fixed in 2.2. To decrease the likelihood of this |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 235 | confusion happening again, netbeans_saved() has been renamed to |
| 236 | netbeans_save_buffer(). |
| 237 | |
Bram Moolenaar | c65c491 | 2006-11-14 17:29:46 +0000 | [diff] [blame] | 238 | We are now at version 2.4. For the differences between 2.3 and 2.4 search for |
| 239 | "2.4" below. |
Bram Moolenaar | 0fd9289 | 2006-03-09 22:27:48 +0000 | [diff] [blame] | 240 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 241 | The messages are currently sent over a socket. Since the messages are in |
| 242 | plain UTF-8 text this protocol could also be used with any other communication |
| 243 | mechanism. |
| 244 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 245 | 6.1 Kinds of messages |nb-messages| |
| 246 | 6.2 Terms |nb-terms| |
| 247 | 6.3 Commands |nb-commands| |
| 248 | 6.4 Functions and Replies |nb-functions| |
| 249 | 6.5 Events |nb-events| |
| 250 | 6.6 Special messages |nb-special| |
| 251 | 6.7 Protocol errors |nb-protocol_errors| |
Bram Moolenaar | 0fd9289 | 2006-03-09 22:27:48 +0000 | [diff] [blame] | 252 | |
| 253 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 254 | 6.1 Kinds of messages *nb-messages* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 255 | |
| 256 | There are four kinds of messages: |
| 257 | |
| 258 | kind direction comment ~ |
| 259 | Command IDE -> editor no reply necessary |
| 260 | Function IDE -> editor editor must send back a reply |
| 261 | Reply editor -> IDE only in response to a Function |
| 262 | Event editor -> IDE no reply necessary |
| 263 | |
| 264 | The messages are sent as a single line with a terminating newline character. |
| 265 | Arguments are separated by a single space. The first item of the message |
| 266 | depends on the kind of message: |
| 267 | |
| 268 | kind first item example ~ |
| 269 | Command bufID:name!seqno 11:showBalloon!123 "text" |
| 270 | Function bufID:name/seqno 11:getLength/123 |
| 271 | Reply seqno 123 5000 |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 272 | Event bufID:name=seqno 11:keyCommand=123 "S-F2" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 273 | |
| 274 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 275 | |
| 276 | 6.2 Terms *nb-terms* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 277 | |
| 278 | bufID Buffer number. A message may be either for a specific buffer |
| 279 | or generic. Generic messages use a bufID of zero. NOTE: this |
| 280 | buffer ID is assigned by the IDE, it is not Vim's buffer |
| 281 | number. The bufID must be a sequentially rising number, |
| 282 | starting at one. |
| 283 | |
| 284 | seqno The IDE uses a sequence number for Commands and Functions. A |
| 285 | Reply must use the sequence number of the Function that it is |
| 286 | associated with. A zero sequence number can be used for |
| 287 | Events (the seqno of the last received Command or Function can |
| 288 | also be used). |
| 289 | |
| 290 | string Argument in double quotes. Text is in UTF-8 encoding. This |
| 291 | means ASCII is passed as-is. Special characters are |
| 292 | represented with a backslash: |
| 293 | \" double quote |
| 294 | \n newline |
| 295 | \r carriage-return |
| 296 | \t tab (optional, also works literally) |
| 297 | \\ backslash |
| 298 | NUL bytes are not allowed! |
| 299 | |
| 300 | boolean Argument with two possible values: |
| 301 | T true |
| 302 | F false |
| 303 | |
| 304 | number Argument with a decimal number. |
| 305 | |
| 306 | optnum Argument with either a decimal number or "none" (without the |
| 307 | quotes). |
| 308 | |
| 309 | offset A number argument that indicates a byte position in a buffer. |
| 310 | The first byte has offset zero. Line breaks are counted for |
| 311 | how they appear in the file (CR/LF counts for two bytes). |
| 312 | Note that a multi-byte character is counted for the number of |
| 313 | bytes it takes. |
| 314 | |
| 315 | lnum/col Argument with a line number and column number position. The |
| 316 | line number starts with one, the column is the byte position, |
| 317 | starting with zero. Note that a multi-byte character counts |
| 318 | for several columns. |
| 319 | |
| 320 | pathname String argument: file name with full path. |
| 321 | |
| 322 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 323 | 6.3 Commands *nb-commands* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 324 | |
| 325 | actionMenuItem Not implemented. |
| 326 | |
| 327 | actionSensitivity |
| 328 | Not implemented. |
| 329 | |
| 330 | addAnno serNum typeNum off len |
| 331 | Place an annotation in this buffer. |
| 332 | Arguments: |
| 333 | serNum number serial number of this placed |
| 334 | annotation, used to be able to remove |
| 335 | it |
| 336 | typeNum number sequence number of the annotation |
| 337 | defined with defineAnnoType for this |
| 338 | buffer |
| 339 | off number offset where annotation is to be placed |
| 340 | len number not used |
| 341 | In version 2.1 "lnum/col" can be used instead of "off". |
| 342 | |
| 343 | balloonResult text |
| 344 | Not implemented. |
| 345 | |
| 346 | close Close the buffer. This leaves us without current buffer, very |
| 347 | dangerous to use! |
| 348 | |
| 349 | create Creates a buffer without a name. Replaces the current buffer |
| 350 | (it's hidden when it was changed). |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 351 | The Vim Controller should use this as the first command for a |
| 352 | file that is being opened. The sequence of commands could be: |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 353 | create |
| 354 | setCaretListener (ignored) |
| 355 | setModified (no effect) |
| 356 | setContentType (ignored) |
| 357 | startDocumentListen |
| 358 | setTitle |
| 359 | setFullName |
| 360 | |
| 361 | defineAnnoType typeNum typeName tooltip glyphFile fg bg |
| 362 | Define a type of annotation for this buffer. |
| 363 | Arguments: |
| 364 | typeNum number sequence number (not really used) |
| 365 | typeName string name that identifies this annotation |
| 366 | tooltip string not used |
| 367 | glyphFile string name of icon file |
| 368 | fg optnum foreground color for line highlighting |
| 369 | bg optnum background color for line highlighting |
| 370 | Vim will define a sign for the annotation. |
| 371 | When both "fg" and "bg" are "none" no line highlighting is |
| 372 | used (new in version 2.1). |
| 373 | When "glyphFile" is empty, no text sign is used (new in |
| 374 | version 2.1). |
| 375 | When "glyphFile" is one or two characters long, a text sign is |
| 376 | defined (new in version 2.1). |
| 377 | Note: the annotations will be defined in sequence, and the |
| 378 | sequence number is later used with addAnno. |
| 379 | |
| 380 | editFile pathname |
| 381 | Set the name for the buffer and edit the file "pathname", a |
| 382 | string argument. |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 383 | Normal way for the IDE to tell the editor to edit a file. |
| 384 | |
| 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: |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 391 | setFullName |
| 392 | insert |
| 393 | initDone |
| 394 | New in version 2.1. |
| 395 | |
| 396 | enableBalloonEval |
| 397 | Not implemented. |
| 398 | |
| 399 | endAtomic End an atomic operation. The changes between "startAtomic" |
| 400 | and "endAtomic" can be undone as one operation. But it's not |
| 401 | implemented yet. Redraw when necessary. |
| 402 | |
| 403 | guard off len |
| 404 | Mark an area in the buffer as guarded. This means it cannot |
| 405 | be edited. "off" and "len" are numbers and specify the text |
| 406 | to be guarded. |
| 407 | |
| 408 | initDone Mark the buffer as ready for use. Implicitly makes the buffer |
| 409 | the current buffer. Fires the BufReadPost autocommand event. |
| 410 | |
Bram Moolenaar | 009b259 | 2004-10-24 19:18:58 +0000 | [diff] [blame] | 411 | insertDone |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 412 | Sent by Vim Controller to tell Vim an initial file insert is |
| 413 | done. This triggers a read message being printed. Prior to |
| 414 | version 2.3, no read messages were displayed after opening a |
| 415 | file. New in version 2.3. |
Bram Moolenaar | 009b259 | 2004-10-24 19:18:58 +0000 | [diff] [blame] | 416 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 417 | moveAnnoToFront serNum |
| 418 | Not implemented. |
| 419 | |
| 420 | netbeansBuffer isNetbeansBuffer |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 421 | If "isNetbeansBuffer" is "T" then this buffer is "owned" by |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 422 | NetBeans. |
| 423 | New in version 2.2. |
| 424 | |
| 425 | putBufferNumber pathname |
| 426 | Associate a buffer number with the Vim buffer by the name |
| 427 | "pathname", a string argument. To be used when the editor |
| 428 | reported editing another file to the IDE and the IDE needs to |
| 429 | tell the editor what buffer number it will use for this file. |
| 430 | Also marks the buffer as initialized. |
| 431 | New in version 2.1. |
| 432 | |
| 433 | raise Bring the editor to the foreground. |
| 434 | New in version 2.1. |
| 435 | |
| 436 | removeAnno serNum |
| 437 | Remove a previously place annotation for this buffer. |
| 438 | "serNum" is the same number used in addAnno. |
| 439 | |
| 440 | save Save the buffer when it was modified. The other side of the |
| 441 | interface is expected to write the buffer and invoke |
| 442 | "setModified" to reset the "changed" flag of the buffer. |
| 443 | The writing is skipped when one of these conditions is true: |
| 444 | - 'write' is not set |
| 445 | - the buffer is read-only |
| 446 | - the buffer does not have a file name |
| 447 | - 'buftype' disallows writing |
| 448 | New in version 2.2. |
| 449 | |
Bram Moolenaar | 009b259 | 2004-10-24 19:18:58 +0000 | [diff] [blame] | 450 | saveDone |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 451 | Sent by Vim Controller to tell Vim a save is done. This |
| 452 | triggers a save message being printed. Prior to version 2.3, |
| 453 | no save messages were displayed after a save. |
Bram Moolenaar | 009b259 | 2004-10-24 19:18:58 +0000 | [diff] [blame] | 454 | New in version 2.3. |
| 455 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 456 | setAsUser Not implemented. |
| 457 | |
| 458 | setBufferNumber pathname |
| 459 | Associate a buffer number with Vim buffer by the name |
| 460 | "pathname". To be used when the editor reported editing |
| 461 | another file to the IDE and the IDE needs to tell the editor |
| 462 | what buffer number it will use for this file. |
| 463 | Has the side effect of making the buffer the current buffer. |
| 464 | See "putBufferNumber" for a more useful command. |
| 465 | |
| 466 | setContentType |
| 467 | Not implemented. |
| 468 | |
| 469 | setDot off Make the buffer the current buffer and set the cursor at the |
Bram Moolenaar | 8b6144b | 2006-02-08 09:20:24 +0000 | [diff] [blame] | 470 | specified position. If the buffer is open in another window |
| 471 | than make that window the current window. |
| 472 | If there are folds they are opened to make the cursor line |
| 473 | visible. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 474 | In version 2.1 "lnum/col" can be used instead of "off". |
| 475 | |
| 476 | setExitDelay seconds |
| 477 | Set the delay for exiting to "seconds", a number. |
| 478 | This delay is used to give the IDE a chance to handle things |
| 479 | before really exiting. The default delay is two seconds. |
| 480 | New in version 2.1. |
Bram Moolenaar | 009b259 | 2004-10-24 19:18:58 +0000 | [diff] [blame] | 481 | Obsolete in version 2.3. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 482 | |
| 483 | setFullName pathname |
| 484 | Set the file name to be used for a buffer to "pathname", a |
| 485 | string argument. |
| 486 | Used when the IDE wants to edit a file under control of the |
| 487 | IDE. This makes the buffer the current buffer, but does not |
| 488 | read the file. "insert" commands will be used next to set the |
| 489 | contents. |
| 490 | |
| 491 | setLocAndSize Not implemented. |
| 492 | |
| 493 | setMark Not implemented. |
| 494 | |
| 495 | setModified modified |
| 496 | When the boolean argument "modified" is "T" mark the buffer as |
| 497 | modified, when it is "F" mark it as unmodified. |
| 498 | |
Bram Moolenaar | 009b259 | 2004-10-24 19:18:58 +0000 | [diff] [blame] | 499 | setModtime time |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 500 | Update a buffers modification time after the file has been |
| 501 | saved directly by the Vim Controller. |
Bram Moolenaar | 009b259 | 2004-10-24 19:18:58 +0000 | [diff] [blame] | 502 | New in version 2.3. |
| 503 | |
| 504 | setReadOnly |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 505 | Set a file as readonly |
| 506 | Implemented in version 2.3. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 507 | |
| 508 | setStyle Not implemented. |
| 509 | |
| 510 | setTitle name |
| 511 | Set the title for the buffer to "name", a string argument. |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 512 | The title is only used for the Vim Controller functions, not |
| 513 | by Vim. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 514 | |
| 515 | setVisible visible |
| 516 | When the boolean argument "visible" is "T", goto the buffer. |
| 517 | The "F" argument does nothing. |
| 518 | |
| 519 | showBalloon text |
| 520 | Show a balloon (popup window) at the mouse pointer position, |
| 521 | containing "text", a string argument. The balloon should |
| 522 | disappear when the mouse is moved more than a few pixels. |
| 523 | New in version 2.1. |
| 524 | |
Bram Moolenaar | 009b259 | 2004-10-24 19:18:58 +0000 | [diff] [blame] | 525 | specialKeys |
| 526 | Map a set of keys (mostly function keys) to be passed back |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 527 | to the Vim Controller for processing. This lets regular IDE |
| 528 | hotkeys be used from Vim. |
Bram Moolenaar | 009b259 | 2004-10-24 19:18:58 +0000 | [diff] [blame] | 529 | Implemented in version 2.3. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 530 | |
| 531 | startAtomic Begin an atomic operation. The screen will not be updated |
| 532 | until "endAtomic" is given. |
| 533 | |
| 534 | startCaretListen |
| 535 | Not implemented. |
| 536 | |
| 537 | startDocumentListen |
| 538 | Mark the buffer to report changes to the IDE with the |
| 539 | "insert" and "remove" events. The default is to report |
| 540 | changes. |
| 541 | |
| 542 | stopCaretListen |
| 543 | Not implemented. |
| 544 | |
| 545 | stopDocumentListen |
| 546 | Mark the buffer to stop reporting changes to the IDE. |
| 547 | Opposite of startDocumentListen. |
Bram Moolenaar | 748bf03 | 2005-02-02 23:04:36 +0000 | [diff] [blame] | 548 | NOTE: if "netbeansBuffer" was used to mark this buffer as a |
| 549 | NetBeans buffer, then the buffer is deleted in Vim. This is |
| 550 | for compatibility with Sun Studio 10. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 551 | |
| 552 | unguard off len |
| 553 | Opposite of "guard", remove guarding for a text area. |
Bram Moolenaar | 8b6144b | 2006-02-08 09:20:24 +0000 | [diff] [blame] | 554 | Also sets the current buffer, if necessary. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 555 | |
| 556 | version Not implemented. |
| 557 | |
| 558 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 559 | 6.4 Functions and Replies *nb-functions* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 560 | |
| 561 | getDot Not implemented. |
| 562 | |
| 563 | getCursor Return the current buffer and cursor position. |
| 564 | The reply is: |
| 565 | seqno bufID lnum col off |
| 566 | seqno = sequence number of the function |
| 567 | bufID = buffer ID of the current buffer (if this is unknown -1 |
| 568 | is used) |
| 569 | lnum = line number of the cursor (first line is one) |
| 570 | col = column number of the cursor (in bytes, zero based) |
| 571 | off = offset of the cursor in the buffer (in bytes) |
| 572 | New in version 2.1. |
| 573 | |
| 574 | getLength Return the length of the buffer in bytes. |
| 575 | Reply example for a buffer with 5000 bytes: |
| 576 | 123 5000 |
| 577 | TODO: explain use of partial line. |
| 578 | |
| 579 | getMark Not implemented. |
| 580 | |
Bram Moolenaar | c65c491 | 2006-11-14 17:29:46 +0000 | [diff] [blame] | 581 | getAnno serNum |
| 582 | Return the line number of the annotation in the buffer. |
| 583 | Argument: |
| 584 | serNum serial number of this placed annotation |
| 585 | The reply is: |
| 586 | 123 lnum line number of the annotation |
| 587 | 123 0 invalid annotation serial number |
| 588 | New in version 2.4. |
| 589 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 590 | getModified When a buffer is specified: Return zero if the buffer does not |
| 591 | have changes, one if it does have changes. |
| 592 | When no buffer is specified (buffer number zero): Return the |
| 593 | number of buffers with changes. When the result is zero it's |
| 594 | safe to tell Vim to exit. |
| 595 | New in version 2.1. |
| 596 | |
| 597 | getText Return the contents of the buffer as a string. |
| 598 | Reply example for a buffer with two lines |
| 599 | 123 "first line\nsecond line\n" |
| 600 | NOTE: docs indicate an offset and length argument, but this is |
| 601 | not implemented. |
| 602 | |
| 603 | insert off text |
| 604 | Insert "text" before position "off". "text" is a string |
| 605 | argument, "off" a number. |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 606 | "text" should have a "\n" (newline) at the end of each line. |
Bram Moolenaar | 0fd9289 | 2006-03-09 22:27:48 +0000 | [diff] [blame] | 607 | Or "\r\n" when 'fileformat' is "dos". When using "insert" in |
| 608 | an empty buffer Vim will set 'fileformat' accordingly. |
| 609 | When "off" points to the start of a line the text is inserted |
| 610 | above this line. Thus when "off" is zero lines are inserted |
| 611 | before the first line. |
| 612 | When "off" points after the start of a line, possibly on the |
| 613 | NUL at the end of a line, the first line of text is appended |
| 614 | to this line. Further lines come below it. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 615 | Possible replies: |
| 616 | 123 no problem |
| 617 | 123 !message failed |
| 618 | Note that the message in the reply is not quoted. |
Bram Moolenaar | 8b6144b | 2006-02-08 09:20:24 +0000 | [diff] [blame] | 619 | Also sets the current buffer, if necessary. |
Bram Moolenaar | 0fd9289 | 2006-03-09 22:27:48 +0000 | [diff] [blame] | 620 | Does not move the cursor to the changed text. |
| 621 | Resets undo information. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 622 | |
| 623 | remove off length |
| 624 | Delete "length" bytes of text at position "off". Both |
| 625 | arguments are numbers. |
| 626 | Possible replies: |
| 627 | 123 no problem |
| 628 | 123 !message failed |
| 629 | Note that the message in the reply is not quoted. |
Bram Moolenaar | 8b6144b | 2006-02-08 09:20:24 +0000 | [diff] [blame] | 630 | Also sets the current buffer, if necessary. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 631 | |
| 632 | saveAndExit Perform the equivalent of closing Vim: ":confirm qall". |
| 633 | If there are no changed files or the user does not cancel the |
| 634 | operation Vim exits and no result is sent back. The IDE can |
| 635 | consider closing the connection as a successful result. |
| 636 | If the user cancels the operation the number of modified |
| 637 | buffers that remains is returned and Vim does not exit. |
| 638 | New in version 2.1. |
| 639 | |
| 640 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 641 | 6.5 Events *nb-events* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 642 | |
| 643 | balloonEval off len type |
| 644 | The mouse pointer rests on text for a short while. When "len" |
| 645 | is zero, there is no selection and the pointer is at position |
| 646 | "off". When "len" is non-zero the text from position "off" to |
| 647 | "off" + "len" is selected. |
| 648 | Only sent after "enableBalloonEval" was used for this buffer. |
| 649 | "type" is not yet defined. |
| 650 | Not implemented yet. |
| 651 | |
| 652 | balloonText text |
| 653 | Used when 'ballooneval' is set and the mouse pointer rests on |
| 654 | some text for a moment. "text" is a string, the text under |
| 655 | the mouse pointer. |
| 656 | New in version 2.1. |
| 657 | |
| 658 | buttonRelease button lnum col |
| 659 | Report which button was pressed and the location of the cursor |
| 660 | at the time of the release. Only for buffers that are owned |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 661 | by the Vim Controller. This event is not sent if the button |
| 662 | was released while the mouse was in the status line or in a |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 663 | separator line. If col is less than 1 the button release was |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 664 | in the sign area. |
| 665 | New in version 2.2. |
| 666 | |
Bram Moolenaar | 009b259 | 2004-10-24 19:18:58 +0000 | [diff] [blame] | 667 | disconnect |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 668 | Tell the Vim Controller that Vim is exiting and not to try and |
| 669 | read or write more commands. |
Bram Moolenaar | 009b259 | 2004-10-24 19:18:58 +0000 | [diff] [blame] | 670 | New in version 2.3. |
| 671 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 672 | fileClosed Not implemented. |
| 673 | |
| 674 | fileModified Not implemented. |
| 675 | |
| 676 | fileOpened pathname open modified |
| 677 | A file was opened by the user. |
| 678 | Arguments: |
| 679 | pathname string name of the file |
| 680 | open boolean always "T" |
| 681 | modified boolean always "F" |
| 682 | |
| 683 | geometry cols rows x y |
| 684 | Report the size and position of the editor window. |
| 685 | Arguments: |
| 686 | cols number number of text columns |
| 687 | rows number number of text rows |
| 688 | x number pixel position on screen |
| 689 | y number pixel position on screen |
| 690 | Only works for Motif. |
| 691 | |
| 692 | insert off text |
| 693 | Text "text" has been inserted in Vim at position "off". |
| 694 | Only fired when enabled, see "startDocumentListen". |
| 695 | |
| 696 | invokeAction Not implemented. |
| 697 | |
| 698 | keyCommand keyName |
| 699 | Reports a special key being pressed with name "keyName", which |
| 700 | is a string. |
| 701 | Supported key names: |
| 702 | F1 function key 1 |
| 703 | F2 function key 2 |
| 704 | ... |
| 705 | F12 function key 12 |
| 706 | |
| 707 | ' ' space (without the quotes) |
| 708 | ! exclamation mark |
| 709 | ... any other ASCII printable character |
| 710 | ~ tilde |
| 711 | |
| 712 | X any unrecognized key |
| 713 | |
| 714 | The key may be prepended by "C", "S" and/or "M" for Control, |
| 715 | Shift and Meta (Alt) modifiers. If there is a modifier a dash |
| 716 | is used to separate it from the key name. For example: |
| 717 | "C-F2". |
| 718 | ASCII characters are new in version 2.1. |
| 719 | |
| 720 | keyAtPos keyName lnum/col |
| 721 | Like "keyCommand" and also report the line number and column |
| 722 | of the cursor. |
| 723 | New in version 2.1. |
| 724 | |
| 725 | killed A file was closed by the user. Only for files that have been |
| 726 | assigned a number by the IDE. |
| 727 | |
| 728 | newDotAndMark off off |
| 729 | Reports the position of the cursor being at "off" bytes into |
| 730 | the buffer. Only sent just before a "keyCommand" event. |
| 731 | |
| 732 | quit Not implemented. |
| 733 | |
| 734 | remove off len |
| 735 | Text was deleted in Vim at position "off" with byte length |
| 736 | "len". |
| 737 | Only fired when enabled, see "startDocumentListen". |
| 738 | |
| 739 | revert Not implemented. |
| 740 | |
| 741 | save The buffer has been saved and is now unmodified. |
| 742 | Only fired when enabled, see "startDocumentListen". |
| 743 | |
| 744 | startupDone The editor has finished its startup work and is ready for |
| 745 | editing files. |
| 746 | New in version 2.1. |
| 747 | |
| 748 | unmodified The buffer is now unmodified. |
| 749 | Only fired when enabled, see "startDocumentListen". |
| 750 | |
| 751 | version vers Report the version of the interface implementation. Vim |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 752 | reports "2.4" (including the quotes). |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 753 | |
| 754 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 755 | 6.6 Special messages *nb-special* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 756 | |
| 757 | These messages do not follow the style of the messages above. They are |
| 758 | terminated by a newline character. |
| 759 | |
| 760 | ACCEPT Not used. |
| 761 | |
| 762 | AUTH password editor -> IDE: First message that the editor sends to the IDE. |
| 763 | Must contain the password for the socket server, as specified |
| 764 | with the |-nb| argument. No quotes are used! |
| 765 | |
| 766 | DISCONNECT IDE -> editor: break the connection. The editor will exit. |
| 767 | The IDE must only send this message when there are no unsaved |
| 768 | changes! |
| 769 | |
| 770 | DETACH IDE -> editor: break the connection without exiting the |
| 771 | editor. Used when the IDE exits without bringing down the |
| 772 | editor as well. |
| 773 | New in version 2.1. |
| 774 | |
| 775 | REJECT Not used. |
| 776 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 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 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 786 | ============================================================================== |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 787 | 7. NetBeans key *netbeans-key* |
Bram Moolenaar | 65c1b01 | 2005-01-31 19:02:28 +0000 | [diff] [blame] | 788 | |
| 789 | *:nbkey* |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 790 | :nbkey key Pass the key to the Vim Controller for processing |
Bram Moolenaar | 65c1b01 | 2005-01-31 19:02:28 +0000 | [diff] [blame] | 791 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 792 | When a hot-key has been installed with the specialKeys command, this command |
| 793 | can be used to generate a hotkey messages to the Vim Controller. The events |
| 794 | newDotAndMark, keyCommand and keyAtPos are generated (in this order). |
| 795 | |
Bram Moolenaar | 65c1b01 | 2005-01-31 19:02:28 +0000 | [diff] [blame] | 796 | |
| 797 | ============================================================================== |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 798 | 8. Known problems *netbeans-problems* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 799 | |
| 800 | NUL bytes are not possible. For editor -> IDE they will appear as NL |
| 801 | characters. For IDE -> editor they cannot be inserted. |
| 802 | |
| 803 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 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 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 937 | vim:tw=78:ts=8:ft=help:norl: |