Skip to content

Instantly share code, notes, and snippets.

@larryx64 larryx64/Sublime.php
Created Jun 25, 2017

Embed
What would you like to do?
Helper class to launch Sublime
<?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;
}
}
@larryx64

This comment has been minimized.

Copy link
Owner Author

larryx64 commented Jun 25, 2017

Just make sure subl is in your $PATH. Although if you follow this tutorial, the command sould be sublime

http://olivierlacan.com/posts/launch-sublime-text-3-from-the-command-line/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.