codekingpro/portable-devtools
114k
1*netbeans.txt* For Vim version 9.2. Last change: 2026 Apr 092 3 4 VIM REFERENCE MANUAL by Gordon Prieur et al.5 6 7 *netbeans* *NetBeans* *netbeans-support*8 9Vim NetBeans Protocol: a socket interface for Vim integration into an IDE.10 111. Introduction |netbeans-intro|122. Integration features |netbeans-integration|133. Configuring Vim for NetBeans |netbeans-configure|144. Error Messages |netbeans-messages|155. Running Vim in NetBeans mode |netbeans-run|166. NetBeans protocol |netbeans-protocol|177. NetBeans commands |netbeans-commands|188. Known problems |netbeans-problems|199. Debugging NetBeans protocol |netbeans-debugging|2010. NetBeans External Editor21 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|26 27{only available when compiled with the |+netbeans_intg| feature}28 29==============================================================================301. Introduction *netbeans-intro*31 32The NetBeans interface was initially developed to integrate Vim into the33NetBeans Java IDE, using the external editor plugin. This NetBeans plugin no34longer exists for recent versions of NetBeans but the protocol was developed35in such a way that any IDE can use it to integrate Vim.36 37The NetBeans protocol of Vim is a text based communication protocol, over a38classical TCP socket. There is no dependency on Java or NetBeans. Any39language or environment providing a socket interface can control Vim using40this protocol. There are existing implementations in C, C++, Python and Java.41The name NetBeans is kept today for historical reasons.42 43Active project using the NetBeans protocol of Vim:44- Eclim, (dead link) eclim.org/45 46VimIntegration, description of various projects doing Vim Integration:47 (dead link) www.freehackers.org/VimIntegration48 49Projects using the NetBeans protocol of Vim are or were:50- Agide, an IDE for the AAP project, written in Python (now replaced by51 |:Termdebug|): http://www.a-a-p.org (link now dead)52- Clewn, a gdb integration into Vim, written in C:53 http://clewn.sourceforge.net/54- Pyclewn, a gdb integration into Vim, written in Python:55 http://pyclewn.sourceforge.net/56- VimWrapper, library to easy Vim integration into IDE:57 (dead link) freehackers.org/VimWrapper58Outdated projects (links don't work):59- VimPlugin, integration of Vim inside Eclipse:60 http://vimplugin.sourceforge.net/wiki/pmwiki.php61- PIDA, IDE written in Python integrating Vim:62 http://pida.co.uk/63 64Check the specific project pages to see how to use Vim with these projects.65 66An alternative is to use a channel, see |channel|.67 68In the rest of this help page, we will use the term "Vim Controller" to69describe the program controlling Vim through the NetBeans socket interface.70 71 72About the NetBeans IDE ~73 74NetBeans is an open source Integrated Development Environment developed75jointly by Sun Microsystems, Inc. and the netbeans.org developer community.76Initially just a Java IDE, NetBeans has had C, C++, and Fortran support added77in recent releases.78 79For more information visit the main NetBeans web site http://www.netbeans.org.80The External Editor is now, unfortunately, declared obsolete. See (link seems81dead): externaleditor.netbeans.org.82 83Sun Microsystems, Inc. also ships NetBeans under the name Sun ONE Studio.84Visit http://www.sun.com for more information regarding the Sun ONE Studio85product line.86 87Current releases of NetBeans provide full support for Java and limited support88for C, C++, and Fortran. Current releases of Sun ONE Studio provide full89support for Java, C, C++, and Fortran.90 91==============================================================================922. Integration features *netbeans-integration*93 94The NetBeans socket interface of Vim allows to get information from Vim or to95ask 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 closed99- be notified of how the buffer content is modified100- load and save files101- modify the buffer content102- installing special key bindings103- raise the window, control the window geometry104 105For sending key strokes to Vim or for evaluating functions in Vim, you must106use the |clientserver| interface.107 108 109==============================================================================1103. Configuring Vim for NetBeans *netbeans-configure*111 112For more help about installing Vim, please read |usr_90.txt| in the Vim User113Manual.114 115 116On Unix:117--------118 119When running configure without arguments the NetBeans interface should be120included. That is, if the configure check to find out if your system supports121the required features succeeds.122 123In case you do not want the NetBeans interface you can disable it by124uncommenting a line with "--disable-netbeans" in the Makefile.125 126Currently the NetBeans interface is supported by Vim running in a terminal and127by gvim when it is run with one of the following GUIs: GTK, GNOME, Windows128and Motif.129 130 *netbeans-xpm*131If Motif support is required the user must supply XPM libraries.132The XPM library is required to show images within Vim with Motif.133Without it the toolbar and signs will be disabled.134 135The XPM library is provided by Arnaud Le Hors of the French National Institute136for Research in Computer Science and Control. It can be downloaded from137https://ftp.nluug.nl/ftp/windowing/X/contrib/libraries/. The current release,138as of this writing, is xpm-3.4k-solaris.tgz, which is a gzip'ed tar file. If139you create the directory /usr/local/xpm and untar the file there you can use140the uncommented lines in the Makefile without changing them. If you use141another xpm directory you will need to change the XPM_DIR in src/Makefile.142 143 144On MS-Windows:145--------------146 147The Win32 support is now in beta stage.148 149To use XPM signs on Win32 (e.g. when using with NetBeans) you can compile150XPM by yourself or use precompiled libraries from (link seems dead):151iamphet.nm.ru/misc/ (for MS Visual C++) or152http://gnuwin32.sourceforge.net (for MinGW).153 154Enable debugging:155-----------------156 157To enable debugging of Vim and of the NetBeans protocol, the "NBDEBUG" macro158needs to be defined. Search in the Makefile of the platform you are using for159"NBDEBUG" to see what line needs to be uncommented. This effectively adds160"-DNBDEBUG" to the compile command. Also see |netbeans-debugging|161 162==============================================================================1634. Error Messages *netbeans-messages*164 165These error messages are specific to NetBeans socket protocol:166 167 *E463*168Region is guarded, cannot modify169 The Vim Controller has defined guarded areas in the text,170 which you cannot change. Also sets the current buffer, if171 necessary.172 173 *E532*174The defineAnnoType highlighting color name is too long175 The maximum length of the "fg" or "bg" color argument in the176 defineAnnoType command is 32 characters.177 New in version 2.5.178 179 *E656*180Writes of unmodified buffers forbidden181 Writes of unmodified buffers that were opened from the182 Vim Controller are not possible.183 184 *E657*185Partial writes disallowed186 Partial writes for buffers that were opened from the187 Vim Controller are not allowed.188 189 *E658*190Connection lost for this buffer191 The Vim Controller has become confused about the state of192 this file. Rather than risk data corruption, it has severed193 the connection for this file. Vim will take over194 responsibility for saving changes to this file and the195 Vim Controller will no longer know of these changes.196 197 *E744*198Read-only file199 Vim normally allows changes to a read-only file and only200 enforces the read-only rule if you try to write the file.201 However, NetBeans does not let you make changes to a file202 which is read-only and becomes confused if Vim does this.203 So Vim does not allow modifications to files when run204 in NetBeans mode.205 206==============================================================================2075. Running Vim in NetBeans mode *netbeans-run*208 209There are two different ways to run Vim in NetBeans mode:210 211 + an IDE may start Vim with the |-nb| command line argument212 + NetBeans can be started from within Vim with the |:nbstart| command213 214Vim uses a 3 second timeout on trying to make the connection.215 216 *netbeans-parameters*217Three forms can be used to setup the NetBeans connection parameters.218When started from the command line, the |-nb| command line argument may be:219 220 -nb={fname} from a file221 -nb:{hostname}:{addr}:{password} directly222 -nb from a file or environment223 224When started from within Vim, the |:nbstart| optional argument may be:225 226 ={fname} from a file227 :{hostname}:{addr}:{password} directly228 <MISSING ARGUMENT> from a file or environment229 230 *E660* *E668*231When NetBeans is started from the command line, for security reasons, the best232method is to write the information in a file readable only by the user. The233name of the file can be passed with the "-nb={fname}" argument or, when "-nb"234is used without a parameter, the environment variable "__NETBEANS_CONINFO".235The file must contain these three lines, in any order:236 237 host={hostname}238 port={addr}239 auth={password}240 241Other lines are ignored. The Vim Controller is responsible for deleting the242file afterwards.243 244{hostname} is the name of the machine where Vim Controller is running. When245omitted the environment variable "__NETBEANS_HOST" is used or the default246"localhost".247 248{addr} is the port number for the NetBeans interface. When omitted the249environment variable "__NETBEANS_SOCKET" is used or the default 3219.250 251{password} is the password for connecting to NetBeans. When omitted the252environment variable "__NETBEANS_VIM_PASSWORD" is used or "changeme".253 254Vim will initiate a socket connection (client side) to the specified host and255port upon startup. The password will be sent with the AUTH event when the256connection has been established.257 258 259==============================================================================2606. NetBeans protocol *netbeans-protocol*261 262The communication between the Vim Controller and Vim uses plain text263messages. This protocol was first designed to work with the external editor264module of NetBeans. Later it was extended to work with Agide (A-A-P GUI IDE,265formerly http://www.a-a-p.org, link now dead) and then with other IDE.266The extensions are marked with "version 2.1".267 268Version 2.2 of the protocol has several minor changes which should only affect269NetBeans users (ie, not Agide users). However, a bug was fixed which could270cause confusion. The netbeans_saved() function sent a "save" protocol271command. In protocol version 2.1 and earlier this was incorrectly interpreted272as a notification that a write had taken place. In reality, it told NetBeans273to save the file so multiple writes were being done. This caused various274problems and has been fixed in 2.2. To decrease the likelihood of this275confusion happening again, netbeans_saved() has been renamed to276netbeans_save_buffer().277 278We are now at version 2.5. For the differences between 2.4 and 2.5 search for279"2.5" below.280 281The messages are currently sent over a socket. Since the messages are in282plain UTF-8 text this protocol could also be used with any other communication283mechanism.284 285Netbeans messages are processed when Vim is idle, waiting for user input.286When Vim is run in non-interactive mode, for example when running an automated287test case that sources a Vim script, the idle loop may not be called often288enough. In that case, insert |:sleep| commands in the Vim script. The |:sleep|289command does invoke Netbeans messages processing.290 2916.1 Kinds of messages |nb-messages|2926.2 Terms |nb-terms|2936.3 Commands |nb-commands|2946.4 Functions and Replies |nb-functions|2956.5 Events |nb-events|2966.6 Special messages |nb-special|2976.7 Protocol errors |nb-protocol_errors|298 299 3006.1 Kinds of messages *nb-messages*301 302There are four kinds of messages:303 304kind direction comment ~305Command IDE -> editor no reply necessary306Function IDE -> editor editor must send back a reply307Reply editor -> IDE only in response to a Function308Event editor -> IDE no reply necessary309 310The messages are sent as a single line with a terminating newline character.311Arguments are separated by a single space. The first item of the message312depends on the kind of message:313 314kind first item example ~315Command bufID:name!seqno 11:showBalloon!123 "text"316Function bufID:name/seqno 11:getLength/123317Reply seqno 123 5000318Event bufID:name=seqno 11:keyCommand=123 "S-F2"319 320 321 3226.2 Terms *nb-terms*323 324bufID Buffer number. A message may be either for a specific buffer325 or generic. Generic messages use a bufID of zero. NOTE: this326 buffer ID is assigned by the IDE, it is not Vim's buffer327 number. The bufID must be a sequentially rising number,328 starting at one. When the 'switchbuf' option is set to329 "usetab" and the "bufID" buffer is not found in the current330 tab page, the netbeans commands and functions that set this331 buffer as the current buffer will jump to the first open332 window that contains this buffer in other tab pages instead of333 replacing the buffer in the current window.334 335seqno The IDE uses a sequence number for Commands and Functions. A336 Reply must use the sequence number of the Function that it is337 associated with. A zero sequence number can be used for338 Events (the seqno of the last received Command or Function can339 also be used).340 341string Argument in double quotes. Text is in UTF-8 encoding. This342 means ASCII is passed as-is. Special characters are343 represented with a backslash:344 \" double quote345 \n newline346 \r carriage-return347 \t tab (optional, also works literally)348 \\ backslash349 NUL bytes are not allowed!350 351boolean Argument with two possible values:352 T true353 F false354 355number Argument with a decimal number.356 357color Argument with either a decimal number, "none" (without the358 quotes) or the name of a color (without the quotes) defined359 both in the color list in |highlight-ctermfg| and in the color360 list in |gui-colors|.361 New in version 2.5.362 363offset A number argument that indicates a byte position in a buffer.364 The first byte has offset zero. Line breaks are counted for365 how they appear in the file (CR/LF counts for two bytes).366 Note that a multibyte character is counted for the number of367 bytes it takes.368 369lnum/col Argument with a line number and column number position. The370 line number starts with one, the column is the byte position,371 starting with zero. Note that a multibyte character counts372 for several columns.373 374pathname String argument: file name with full path.375 376 3776.3 Commands *nb-commands*378 379actionMenuItem Not implemented.380 381actionSensitivity382 Not implemented.383 384addAnno serNum typeNum off len385 Place an annotation in this buffer.386 Arguments:387 serNum number serial number of this placed388 annotation, used to be able to remove389 it390 typeNum number sequence number of the annotation391 defined with defineAnnoType for this392 buffer393 off number offset where annotation is to be394 placed395 len number not used396 In version 2.1 "lnum/col" can be used instead of "off".397 398balloonResult text399 Not implemented.400 401close Close the buffer. This leaves us without current buffer, very402 dangerous to use!403 404create Creates a buffer without a name. Replaces the current buffer405 (it's hidden when it was changed).406 The Vim Controller should use this as the first command for a407 file that is being opened. The sequence of commands could be:408 create409 setCaretListener (ignored)410 setModified (no effect)411 setContentType (ignored)412 startDocumentListen413 setTitle414 setFullName415 416defineAnnoType typeNum typeName tooltip glyphFile fg bg417 Define a type of annotation for this buffer.418 Arguments:419 typeNum number sequence number (not really used)420 typeName string name that identifies this annotation421 tooltip string not used422 glyphFile string name of icon file423 fg color foreground color for line highlighting424 bg color background color for line highlighting425 Vim will define a sign for the annotation.426 When color is a number, this is the "#rrggbb" Red, Green and427 Blue values of the color (see |gui-colors|) and the428 highlighting is only defined for gVim.429 When color is a name, this color is defined both for Vim430 running in a color terminal and for gVim.431 When both "fg" and "bg" are "none" no line highlighting is432 used (new in version 2.1).433 When "glyphFile" is empty, no text sign is used (new in434 version 2.1).435 When "glyphFile" is one or two characters long, a text sign is436 defined (new in version 2.1).437 Note: the annotations will be defined in sequence, and the438 sequence number is later used with addAnno.439 440editFile pathname441 Set the name for the buffer and edit the file "pathname", a442 string argument.443 Normal way for the IDE to tell the editor to edit a file.444 445 You must set a bufId different of 0 with this command to446 assign a bufId to the buffer. It will trigger an event447 fileOpened with a bufId of 0 but the buffer has been assigned.448 449 If the IDE is going to pass the file text to the editor use450 these commands instead:451 setFullName452 insert453 initDone454 New in version 2.1.455 456enableBalloonEval457 Not implemented.458 459endAtomic End an atomic operation. The changes between "startAtomic"460 and "endAtomic" can be undone as one operation. But it's not461 implemented yet. Redraw when necessary.462 463guard off len464 Mark an area in the buffer as guarded. This means it cannot465 be edited. "off" and "len" are numbers and specify the text466 to be guarded.467 468initDone Mark the buffer as ready for use. Implicitly makes the buffer469 the current buffer. Fires the BufReadPost autocommand event.470 471insertDone starteol readonly472 Sent by Vim Controller to tell Vim an initial file insert is473 done. This triggers a read message being printed. If474 "starteol" is "F" then the last line doesn't have a EOL. If475 "readonly" is "T" then the file is marked as readonly. Prior476 to version 2.3, no read messages were displayed after opening477 a file. New in version 2.3.478 479moveAnnoToFront serNum480 Not implemented.481 482netbeansBuffer isNetbeansBuffer483 If "isNetbeansBuffer" is "T" then this buffer is "owned" by484 NetBeans.485 New in version 2.2.486 487putBufferNumber pathname488 Associate a buffer number with the Vim buffer by the name489 "pathname", a string argument. To be used when the editor490 reported editing another file to the IDE and the IDE needs to491 tell the editor what buffer number it will use for this file.492 Also marks the buffer as initialized.493 New in version 2.1.494 495raise Bring the editor to the foreground.496 Only when Vim is run with a GUI.497 New in version 2.1.498 499removeAnno serNum500 Remove a previously placed annotation for this buffer.501 "serNum" is the same number used in addAnno.502 503save Save the buffer when it was modified. The other side of the504 interface is expected to write the buffer and invoke505 "setModified" to reset the "changed" flag of the buffer.506 The writing is skipped when one of these conditions is true:507 - 'write' is not set508 - the buffer is read-only509 - the buffer does not have a file name510 - 'buftype' disallows writing511 New in version 2.2.512 513saveDone514 Sent by Vim Controller to tell Vim a save is done. This515 triggers a save message being printed. Prior to version 2.3,516 no save messages were displayed after a save.517 New in version 2.3.518 519setAsUser Not implemented.520 521setBufferNumber pathname522 Associate a buffer number with Vim buffer by the name523 "pathname". To be used when the editor reported editing524 another file to the IDE and the IDE needs to tell the editor525 what buffer number it will use for this file.526 Has the side effect of making the buffer the current buffer.527 See "putBufferNumber" for a more useful command.528 529setContentType530 Not implemented.531 532setDot off Make the buffer the current buffer and set the cursor at the533 specified position. If the buffer is open in another window534 than make that window the current window.535 If there are folds they are opened to make the cursor line536 visible.537 In version 2.1 "lnum/col" can be used instead of "off".538 539setExitDelay seconds540 Set the delay for exiting to "seconds", a number.541 This delay is used to give the IDE a chance to handle things542 before really exiting. The default delay is two seconds.543 New in version 2.1.544 Obsolete in version 2.3.545 546setFullName pathname547 Set the file name to be used for a buffer to "pathname", a548 string argument.549 Used when the IDE wants to edit a file under control of the550 IDE. This makes the buffer the current buffer, but does not551 read the file. "insert" commands will be used next to set the552 contents.553 554setLocAndSize Not implemented.555 556setMark Not implemented.557 558setModified modified559 When the boolean argument "modified" is "T" mark the buffer as560 modified, when it is "F" mark it as unmodified.561 562setModtime time563 Update a buffers modification time after the file has been564 saved directly by the Vim Controller.565 New in version 2.3.566 567setReadOnly readonly568 When the boolean argument "readonly" is "T" for True, mark the569 buffer as readonly, when it is "F" for False, mark it as not570 readonly. Implemented in version 2.3.571 572setStyle Not implemented.573 574setTitle name575 Set the title for the buffer to "name", a string argument.576 The title is only used for the Vim Controller functions, not577 by Vim.578 579setVisible visible580 When the boolean argument "visible" is "T", goto the buffer.581 The "F" argument does nothing.582 583showBalloon text584 Show a balloon (popup window) at the mouse pointer position,585 containing "text", a string argument. The balloon should586 disappear when the mouse is moved more than a few pixels.587 Only when Vim is run with a GUI.588 New in version 2.1.589 590specialKeys591 Map a set of keys (mostly function keys) to be passed back592 to the Vim Controller for processing. This lets regular IDE593 hotkeys be used from Vim.594 Implemented in version 2.3.595 596startAtomic Begin an atomic operation. The screen will not be updated597 until "endAtomic" is given.598 599startCaretListen600 Not implemented.601 602startDocumentListen603 Mark the buffer to report changes to the IDE with the604 "insert" and "remove" events. The default is to report605 changes.606 607stopCaretListen608 Not implemented.609 610stopDocumentListen611 Mark the buffer to stop reporting changes to the IDE.612 Opposite of startDocumentListen.613 NOTE: if "netbeansBuffer" was used to mark this buffer as a614 NetBeans buffer, then the buffer is deleted in Vim. This is615 for compatibility with Sun Studio 10.616 617unguard off len618 Opposite of "guard", remove guarding for a text area.619 Also sets the current buffer, if necessary.620 621version Not implemented.622 623 6246.4 Functions and Replies *nb-functions*625 626getDot Not implemented.627 628getCursor Return the current buffer and cursor position.629 The reply is:630 seqno bufID lnum col off631 seqno = sequence number of the function632 bufID = buffer ID of the current buffer (if this is unknown -1633 is used)634 lnum = line number of the cursor (first line is one)635 col = column number of the cursor (in bytes, zero based)636 off = offset of the cursor in the buffer (in bytes)637 New in version 2.1.638 639getLength Return the length of the buffer in bytes.640 Reply example for a buffer with 5000 bytes:641 123 5000642 TODO: explain use of partial line.643 644getMark Not implemented.645 646getAnno serNum647 Return the line number of the annotation in the buffer.648 Argument:649 serNum serial number of this placed650 annotation651 The reply is:652 123 lnum line number of the annotation653 123 0 invalid annotation serial number654 New in version 2.4.655 656getModified When a buffer is specified: Return zero if the buffer does not657 have changes, one if it does have changes.658 When no buffer is specified (buffer number zero): Return the659 number of buffers with changes. When the result is zero it's660 safe to tell Vim to exit.661 New in version 2.1.662 663getText Return the contents of the buffer as a string.664 Reply example for a buffer with two lines665 123 "first line\nsecond line\n"666 NOTE: docs indicate an offset and length argument, but this is667 not implemented.668 669insert off text670 Insert "text" before position "off". "text" is a string671 argument, "off" a number.672 "text" should have a "\n" (newline) at the end of each line.673 Or "\r\n" when 'fileformat' is "dos". When using "insert" in674 an empty buffer Vim will set 'fileformat' accordingly.675 When "off" points to the start of a line the text is inserted676 above this line. Thus when "off" is zero lines are inserted677 before the first line.678 When "off" points after the start of a line, possibly on the679 NUL at the end of a line, the first line of text is appended680 to this line. Further lines come below it.681 Possible replies:682 123 no problem683 123 !message failed684 Note that the message in the reply is not quoted.685 Also sets the current buffer, if necessary.686 Does not move the cursor to the changed text.687 Resets undo information.688 689remove off length690 Delete "length" bytes of text at position "off". Both691 arguments are numbers.692 Possible replies:693 123 no problem694 123 !message failed695 Note that the message in the reply is not quoted.696 Also sets the current buffer, if necessary.697 698saveAndExit Perform the equivalent of closing Vim: ":confirm qall".699 If there are no changed files or the user does not cancel the700 operation Vim exits and no result is sent back. The IDE can701 consider closing the connection as a successful result.702 If the user cancels the operation the number of modified703 buffers that remains is returned and Vim does not exit.704 New in version 2.1.705 706 7076.5 Events *nb-events*708 709balloonEval off len type710 The mouse pointer rests on text for a short while. When "len"711 is zero, there is no selection and the pointer is at position712 "off". When "len" is non-zero the text from position "off" to713 "off" + "len" is selected.714 Only sent after "enableBalloonEval" was used for this buffer.715 "type" is not yet defined.716 Not implemented yet.717 718balloonText text719 Used when 'ballooneval' is set and the mouse pointer rests on720 some text for a moment. "text" is a string, the text under721 the mouse pointer.722 Only when Vim is run with a GUI.723 New in version 2.1.724 725buttonRelease button lnum col726 Report which button was pressed and the location of the cursor727 at the time of the release. Only for buffers that are owned728 by the Vim Controller. This event is not sent if the button729 was released while the mouse was in the status line or in a730 separator line. If col is less than 1 the button release was731 in the sign area.732 New in version 2.2.733 734disconnect735 Tell the Vim Controller that Vim is exiting and not to try and736 read or write more commands.737 New in version 2.3.738 739fileClosed Not implemented.740 741fileModified Not implemented.742 743fileOpened pathname open modified744 A file was opened by the user.745 Arguments:746 pathname string name of the file747 open boolean always "T"748 modified boolean always "F"749 750geometry cols rows x y751 Report the size and position of the editor window.752 Arguments:753 cols number number of text columns754 rows number number of text rows755 x number pixel position on screen756 y number pixel position on screen757 Only works for Motif.758 759insert off text760 Text "text" has been inserted in Vim at position "off".761 Only fired when enabled, see "startDocumentListen".762 763invokeAction Not implemented.764 765keyCommand keyName766 Reports a special key being pressed with name "keyName", which767 is a string.768 Supported key names:769 F1 function key 1770 F2 function key 2771 ...772 F12 function key 12773 774 ' ' space (without the quotes)775 ! exclamation mark776 ... any other ASCII printable character777 ~ tilde778 779 X any unrecognized key780 781 The key may be prepended by "C", "S" and/or "M" for Control,782 Shift and Meta (Alt) modifiers. If there is a modifier a dash783 is used to separate it from the key name. For example:784 "C-F2".785 ASCII characters are new in version 2.1.786 787keyAtPos keyName lnum/col788 Like "keyCommand" and also report the line number and column789 of the cursor.790 New in version 2.1.791 792killed A file was deleted or wiped out by the user and the buffer793 annotations have been removed. The bufID number for this794 buffer has become invalid. Only for files that have been795 assigned a bufID number by the IDE.796 797newDotAndMark off off798 Reports the position of the cursor being at "off" bytes into799 the buffer. Only sent just before a "keyCommand" event.800 801quit Not implemented.802 803remove off len804 Text was deleted in Vim at position "off" with byte length805 "len".806 Only fired when enabled, see "startDocumentListen".807 808revert Not implemented.809 810save The buffer has been saved and is now unmodified.811 Only fired when enabled, see "startDocumentListen".812 813startupDone The editor has finished its startup work and is ready for814 editing files.815 New in version 2.1.816 817unmodified The buffer is now unmodified.818 Only fired when enabled, see "startDocumentListen".819 820version vers Report the version of the interface implementation. Vim821 reports "2.4" (including the quotes).822 823 8246.6 Special messages *nb-special*825 826These messages do not follow the style of the messages above. They are827terminated by a newline character.828 829ACCEPT Not used.830 831AUTH password editor -> IDE: First message that the editor sends to the IDE.832 Must contain the password for the socket server, as specified833 with the |-nb| argument. No quotes are used!834 835DISCONNECT IDE -> editor: break the connection. The editor will exit.836 The IDE must only send this message when there are no unsaved837 changes!838 839DETACH IDE -> editor: break the connection without exiting the840 editor. Used when the IDE exits without bringing down the841 editor as well.842 New in version 2.1.843 844REJECT Not used.845 846 8476.7 Protocol errors *nb-protocol_errors*848 849These errors occur when a message violates the protocol:850*E627* *E628* *E629* *E632* *E633* *E634* *E635* *E636*851*E637* *E638* *E639* *E640* *E641* *E642* *E643* *E644* *E645* *E646*852*E647* *E648* *E649* *E650* *E651* *E652*853 854 855==============================================================================8567. NetBeans commands *netbeans-commands*857 858 *:nbstart* *E511* *E838*859:nbs[tart] {connection} Start a new Netbeans session with {connection} as the860 socket connection parameters. The format of861 {connection} is described in |netbeans-parameters|.862 At any time, one may check if the netbeans socket is863 connected by running the command:864 ':echo has("netbeans_enabled")'865 866 *:nbclose*867:nbc[lose] Close the current NetBeans session. Remove all placed868 signs.869 870 *:nbkey*871:nb[key] {key} Pass the {key} to the Vim Controller for processing.872 When a hot-key has been installed with the specialKeys873 command, this command can be used to generate a hotkey874 message to the Vim Controller.875 This command can also be used to pass any text to the876 Vim Controller. It is used by Pyclewn, for example,877 to build the complete set of gdb commands as Vim user878 commands.879 The events newDotAndMark, keyCommand and keyAtPos are880 generated (in this order).881 882 883==============================================================================8848. Known problems *netbeans-problems*885 886NUL bytes are not possible. For editor -> IDE they will appear as NL887characters. For IDE -> editor they cannot be inserted.888 889A NetBeans session may be initiated with Vim running in a terminal, and890continued later in a GUI environment after running the |:gui| command. In this891case, the highlighting defined for the NetBeans annotations may be cleared892when the ":gui" command sources .gvimrc and this file loads a colorscheme893that runs the command ":highlight clear".894New in version 2.5.895 896 897==============================================================================8989. Debugging NetBeans protocol *netbeans-debugging*899 900To debug the Vim protocol, you must first compile Vim with debugging support901and NetBeans debugging support. See |netbeans-configure| for instructions902about Vim compiling and how to enable debug support.903 904When running Vim, set the following environment variables:905 906 export SPRO_GVIM_DEBUG=netbeans.log907 export SPRO_GVIM_DLEVEL=0xffffffff908 909Vim will then log all the incoming and outgoing messages of the NetBeans910protocol to the file netbeans.log .911 912The content of netbeans.log after a session looks like this:913Tue May 20 17:19:27 2008914EVT: 0:startupDone=0915CMD 1: (1) create916CMD 2: (1) setTitle "testfile1.txt"917CMD 3: (1) setFullName "testfile1.txt"918EVT(suppressed): 1:remove=3 0 -1919EVT: 1:fileOpened=0 "d:\\work\\vimWrapper\\vimWrapper2\\pyvimwrapper\\tests\\testfile1.txt" T F920CMD 4: (1) initDone921FUN 5: (0) getCursor922REP 5: 1 1 0 0923CMD 6: (2) create924CMD 7: (2) setTitle "testfile2.txt"925CMD 8: (2) setFullName "testfile2.txt"926EVT(suppressed): 2:remove=8 0 -1927EVT: 2:fileOpened=0 "d:\\work\\vimWrapper\\vimWrapper2\\pyvimwrapper\\tests\\testfile2.txt" T F928CMD 9: (2) initDone929 930 931==============================================================================93210. NetBeans External Editor933 934NOTE: This information is obsolete! Only relevant if you are using an old935version of NetBeans.936 937 93810.1. Downloading NetBeans *netbeans-download*939 940The NetBeans IDE is available for download from netbeans.org. You can941download a released version, download sources, or use CVS to download the942current source tree. If you choose to download sources, follow directions943from netbeans.org on building NetBeans.944 945Depending on the version of NetBeans you download, you may need to do further946work to get the required External Editor module. This is the module which947lets NetBeans work with gvim (or xemacs :-). See (dead link)948externaleditor.netbeans.org949for details on downloading this module if your NetBeans release does not have950it.951 952For C, C++, and Fortran support you will also need the cpp module. See953cpp.netbeans.org (link seems dead) for information regarding this954module.955 956You can also download Sun ONE Studio from Sun Microsystems, Inc for a 30 day957free trial. See http://www.sun.com for further details.958 959 96010.2. NetBeans Key Bindings *netbeans-keybindings*961 962Vim understands a number of key bindings that execute NetBeans commands.963These are typically all the Function key combinations. To execute a NetBeans964command, the user must press the Pause key followed by a NetBeans key binding.965For example, in order to compile a Java file, the NetBeans key binding is966"F9". So, while in vim, press "Pause F9" to compile a java file. To toggle a967breakpoint at the current line, press "Pause Shift F8".968 969The Pause key is Function key 21. If you don't have a working Pause key and970want to use F8 instead, use: >971 972 :map <F8> <F21>973 974The External Editor module dynamically reads the NetBeans key bindings so vim975should always have the latest key bindings, even when NetBeans changes them.976 977 97810.3. Preparing NetBeans for Vim *netbeans-preparation*979 980In order for NetBeans to work with vim, the NetBeans External Editor module981must be loaded and enabled. If you have a Sun ONE Studio Enterprise Edition982then this module should be loaded and enabled. If you have a NetBeans release983you may need to find another way of obtaining this open source module.984 985You can check if you have this module by opening the Tools->Options dialog986and drilling down to the "Modules" list (IDE Configuration->System->Modules).987If your Modules list has an entry for "External Editor" you must make sure988it is enabled (the "Enabled" property should have the value "True"). If your989Modules list has no External Editor see the next section on |obtaining-exted|.990 991 99210.4. Obtaining the External Editor Module *obtaining-exted*993 994There are 2 ways of obtaining the External Editor module. The easiest way995is to use the NetBeans Update Center to download and install the module.996Unfortunately, some versions do not have this module in their update997center. If you cannot download via the update center you will need to998download sources and build the module. I will try and get the module999available from the NetBeans Update Center so building will be unnecessary.1000Also check (dead link) externaleditor.netbeans.org1001for other availability options.1002 1003To download the External Editor sources via CVS and build your own module,1004see (dead link) externaleditor.netbeans.org and http://www.netbeans.org.1005Unfortunately, this is not a trivial procedure.1006 1007 100810.5. Setting up NetBeans to run with Vim *netbeans-setup*1009 1010Assuming you have loaded and enabled the NetBeans External Editor module1011as described in |netbeans-preparation| all you need to do is verify that1012the gvim command line is properly configured for your environment.1013 1014Open the Tools->Options dialog and open the Editing category. Select the1015External Editor. The right hand pane should contain a Properties tab and1016an Expert tab. In the Properties tab make sure the "Editor Type" is set1017to "Vim". In the Expert tab make sure the "Vim Command" is correct.1018 1019You should be careful if you change the "Vim Command". There are command1020line options there which must be there for the connection to be properly1021set up. You can change the command name but that's about it. If your gvim1022can be found by your $PATH then the Vim Command can start with "gvim". If1023you don't want gvim searched from your $PATH then hard code in the full1024Unix path name. At this point you should get a gvim for any source file1025you open in NetBeans.1026 1027If some files come up in gvim and others (with different file suffixes) come1028up in the default NetBeans editor you should verify the MIME type in the1029Expert tab MIME Type property. NetBeans is MIME oriented and the External1030Editor will only open MIME types specified in this property.1031 1032 1033 vim:tw=78:ts=8:noet:ft=help:norl:1034 