I'm working on a large static website (Jekyll) and would like to be able to click on a link on a page in browser (Chrome) which will open it's corresponding source file on the local machine (Sublime). I can get the absolute link of the file.
From the console (Ubuntu) I can do:
to open a file, so perhaps an extension that allows command execution on trusted domains?
There's a Chrome extension, that let's you open a link with an external application: Open with external application
Ubuntu There is a solution for Ubuntu
You first have to install a Protocol Handler in the Windows registry. (Reference: Custom protocol handler in chrome)
This will get Chrome to run a command when a
subl:path/to/file link is clicked.
But you can't simply run
sublime_text.exe subl:path/to/file, because Sublime doesn't understand the
subl:path/to/file parameter. You first have to extract the filename with a script and then call Sublime with a single file parameter.
This is a Solution for Windows, that opens links with the format
It first registers a Script as a Protocol Handler, which in turn calls Sublime
I edited Solution 1 to open links in the format
Just follow Solution 1, but change
' path to sublime_text.exe Dim sublime_path ' CHANGE THIS: sublime_path = "C:\Programme\Sublime Text 3\sublime_text.exe" Dim text, filename ' get first command line argument text = WScript.Arguments.Item(0) filename = Split(text, ":/")(1) Dim run_command run_command = """"&sublime_path&""" """&filename&"""" Dim objShell Set objShell = WScript.CreateObject( "WScript.Shell" ) objShell.Run(run_command) Set objShell = Nothing
(You have to change the path to your sublime_text.exe)
Old question, but you can try this: subl://path/to/file.txt