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