Search code examples
macosideprotocols

Open file in editor from browser, on Mac


I'd like to have a link which allows me to open a file in my favorite IDE. Textmate registeres it's own protocol txmt://open/?url=file://%file&line=%line and it works fine, but I can't find out how to open the file in some other application (for example NetBeans).

This probably requires registering some protocols and setting my browser - I'd like to register it on Chrome.


Solution

  • It doesn't appear to be difficult to register a system-wide URL handler for a protocol you design. In your handler you can send the file on to your IDE. The handler can be Cocoa based or applescript.

    For a Cocoa solution, see this post. For a real world Cocoa example, you can look at bwana.

    For an applescript solution, see this post or this post for a start.