Vim logo vim online Vim Book Ad

java_apidoc.vim : Javadoc viewer

 script karma  Rating 8/2, Downloaded by 274

created by
Paul Etchells
 
script type
ftplugin
 
description
Opens a browser showing the Javadoc for an imported package on the same line as the cursor, or for a class name under the cursor.
 
install details
1) Put this file in ~/.vim/ftplugin (or wherever Vim looks for plugins).
2) (gVIM) Add the following lines to ~/.vimrc
-----------------------------------------------------------------------------
au FileType java let browser="xterm --geometry 100x40 -e lynx"
au FileType java let javadoc_path="/home/etch/Dox/java-1.4-api,/home/etch/Dox/ejb"
au FileType java nmap <F2> viw"jy:call OpenJavadoc("^Rj")^M
-----------------------------------------------------------------------------

(Note:  ^R is CTRL-V CTRL-R,  ^M is CTRL-V CTRL-M)

CONFIGURATION - BROWSER
If you don't want to use xterm and lynx to show the help, you can change 'browser="..."' to whatever browser is on your system. e.g. To browse with Opera:
-----------------------------------------------------------------------------
au FileType java let browser="opera"
-----------------------------------------------------------------------------

If you try this with Netscape it may complain about a 'lock' file, since it tries to start a new instance of the browser for each page found. Of course, you can just say 'OK' at the dialogue, but it gets irritating. Mozilla tries to start a new instance with a different profile, so neither of these browsers are usable with this macro :o(

CONFIGURATION - JAVADOC PATH
Just set the javadoc_path variable to a comma separated list of paths to the tops of the Javadoc trees.

CONFIGURATION - KEY AND REGISTER ASSIGNMENT
The third line uses the <F2> key to start the macro, and the j register to act as a temporary visual buffer for getting the word under the cursor into the function call. Change these if you use them for something else.

CAVEAT
It can be pretty slow when looking for a class name and your javadoc_path contains a lot of files.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
java_apidoc.vim 1.0.1 29-Jul-2002 6.0 Paul Etchells Some minor errors in the comments, viz: java_api_path should be javadoc_path
java_apidoc.vim 1.0 29-Jul-2002 6.0 Paul Etchells Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to [email protected] after searching the archive. Help Bram help Uganda.
SourceForge Logo