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