Opening Sublime Text files in other applications
Here’s a simple plugin for Sublime Text that you can modify to suit your own needs.
I often find myself using different plain-text apps for different purposes. Sublime Text is my go-to app for coding and technical writing, mainly due to all the usual factors: syntax highlighting, snippets, plugins and so on. However, I often find myself switching to Byword for longer-form writing, or just when I want a more prose-friendly environment. Unfortunately, Sublime Text lacks an “Open in…” menu item like you see in, for example, Notational Velocity. What it does have is incredible support for plugins, so I figured it wouldn’t be too hard to make one for my purposes.
In fact, it’s ridiculously easy. Here’s the sum total of code needed to make an “Open in Byword” command:
1 2 3 4 5
import sublime, sublime_plugin, subprocess class OpenInBywordCommand(sublime_plugin.TextCommand): def run(self, edit): subprocess.Popen(["open", "-a", "Byword.app", self.view.file_name()])
By using the OS X command
open you even bypass the work of locating the app.