Created
June 25, 2017 17:27
-
-
Save larryx64/a95acfa62d2f8b86c419959881ce7a7c to your computer and use it in GitHub Desktop.
Helper class to launch Sublime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Sublime | |
{ | |
/** | |
* Sublime shell command | |
*/ | |
const COMMAND = 'subl'; | |
/** | |
* Launch sublime and open file | |
* | |
* @param string $file | |
* @return void | |
*/ | |
public static function openFile($file) | |
{ | |
exec(self::COMMAND .' '. $file); | |
} | |
/** | |
* Get Sublime file url (clickable URL from the browser) | |
* | |
* @param string $file | |
* @return string | |
*/ | |
public static function fileUrl($file) | |
{ | |
return self::COMMAND . '://open?url=file://' . $file; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just make sure
subl
is in your$PATH
. Although if you follow this tutorial, the command sould besublime
http://olivierlacan.com/posts/launch-sublime-text-3-from-the-command-line/