DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Lookup PHP Docs Directly From JEdit (OS X)

08.15.2005
| 2577 views |
  • submit to reddit
        This is a BeanShell script that opens your browser and loads the PHP documentation page for the PHP function selected in the current buffer.

To install
1. Save this file as ~/.jedit/macros/PHPLookup.bsh
2. Select some text in jEdit
3. Select PHPLookup from the Macros Menu

NB. If you're running something other than OS X you will probably need to edit the script and replace the command string with something more appropriate - firefox will probably work on Linux if you have it installed.

String docURL = "http://nz.php.net/manual-lookup.php?pattern="; 
String command = "open";  
String selection = textArea.getSelectedText();
if (selection != "") {
	String docSearch = docURL + selection;
	Runtime.getRuntime().exec(new String[] {command, docSearch });
}
    

Comments

Snippets Manager replied on Mon, 2012/05/07 - 2:14pm

thanks for this! took some tweaking to get it in windows (had to change command to "C:\\Program Files\\Mozilla Firefox\\firefox.exe") but its really quite nice once a key command is assigned to it...