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