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