Skip to content

Add subl:// protocol to Windows and handle opening files in Sublime text editor

Notifications You must be signed in to change notification settings

miss55/sublime-protocol-win

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

sublime-protocol-win

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.

NOTE

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

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

Setup

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)

sublime-custom-protocol.reg

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.

To remove subl:// protocol

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

open_file.vbs

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

You're all set

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

URLDecode function was taken from http://www.motobit.com/tips/detpg_URLDecode/

About

Add subl:// protocol to Windows and handle opening files in Sublime text editor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Visual Basic .NET 100.0%