Reputation: 7941
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.
Upvotes: 4
Views: 534
Reputation: 641
I recently have been working in rails and error pages was set by default to open with txmt, to fix that I get with this idea.
download this wonderful tool https://github.com/johnste/finicky this is able to open certain pages in different browsers or rewrite domains for example.
Edith the config, so we're going to rewrite txmt
format to vscode
format
module.exports = {
rewrite: [
{
match: /^txmt:\/\/open\?url=file:\/\/(.*)/,
url: ({ urlString }) => {
const newPath = urlString
.replace("txmt://open?url=file://", "vscode://file/")
.replace("&line=", ":")
.replace("&column=", ":")
finicky.log(newPath)
return newPath
}
},
],
handlers: [
{
match: /^vscode:\/\/(.*)/,
browser: "Visual Studio Code"
}
]
}
txmt:
to finicky app, so, we do this in terminal:# install duti https://github.com/moretension/duti/
brew install duti
# then associate the protocol
duti -s net.kassett.finicky txmt
Upvotes: 0
Reputation: 49019
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.
Upvotes: 4