Setting up Custom URI scheme handler for Windows to open files in Sublime editor
Created to parse URI's generated by filp/whoops
Parsing is done with VBScript, as that was the only way I found to open Sublime editor, while avoiding annoying command prompt window to pop up and close.
After downloading / cloning the repository, you have to edit files to update path to open_file.vbs
and to add path to Sublime editor
Currently I don't have time to create install/uninstall scripts, so any help is welcome
Also, README.md is all upside-down, so that will be updated soon
whoops is an error handler framework for PHP. More about whoops
When using the pretty error page feature, whoops comes with the ability to open referenced files directly in your IDE or editor.
More on how to setup sublime here
In command prompt, navigate to location where you want to clone repository, and run this command
git clone https://github.com/ljubadr/sublime-protocol-win.git
Take a note of a folder path where you cloned this repository, as it will be used later
Navigate to the folder where you cloned repository (downloaded)
Before you merge this registry file, you need to edit this file.
Open file sublime-custom-protocol.reg
in your favourite editor
On the last line
@="WSCRIPT \"C:\\sublime-protocol-win\\open_file.vbs\" \"%1\""
change
C:\\sublime-protocol-win\\
to the path where you cloned this repository
Take a note that you need \\
in the folder path
Save the file
Double click sublime-custom-protocol.reg
to add new registry entry.
Press Start button, then type regedit
Wait a little bit and in the search result will get regedit.exe
(Registry Editor)
Open HKEY_CLASSES_ROOT
, and then find subl
, right click -> delete
This is the script that will be called to process new custom URI protocol subl://
Open file open_file.vbs
in editor, and find line
sublime_path = "C:\Program Files (x86)\Sublime Text 3\sublime_text.exe"
Replace existing path with the path of your Sublime instalation
Or if you're using Sublime portable, enter path to .exe file
All pages that have whoops errors will generate url with the link to a file
When you click on the link for the first time, browser will ask about permissions, so be sure to select allow
Little note for Chrome users, opening files will only work by clickning on generated link
Trying to paste generated link in URL will not work
URLDecode function was taken from http://www.motobit.com/tips/detpg_URLDecode/