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