Jump to content
phyllisstein

Open in Sublime

Recommended Posts

Hello, workers of flow! I've converted an old extension to a workflow, and thought you might like to give the results a shot.

 

Open in Sublime defines the subl keyword. If you enter a path, it'll open that file in Sublime Text 2; if you select something in the frontmost Finder window and enter the keyword, it'll open the selected files or folders; and if you enter the keyword without anything selected or a path, it'll open the frontmost Finder window's folder in Sublime. If you've tried this before, be aware that I redid the AppleScript so that it now ought to work properly with Finder selections.

 

Let me know if you have any problems! I'm @phyllisstein on Twitter and d-at-daniel-dot-sh if that's easier.

Share this post


Link to post
hey phyllisstein, the search workflow link is dead

 

Oops! I'm afraid I deleted it from my Droplr—and apparently, also from Alfred. There's a much better workflow by bigluck, in AlfPT, that uses the feedback system to list and open recent projects. The search workflow I'd had was just a file filter linked to `subl -p "{query}"`.

Share this post


Link to post

Just updated this workflow so that it'll check to see whether Sublime Text 2 or 3 is installed (defaults to 3) instead of failing if you had the wrong version. Download at the link above.

Share this post


Link to post
Thank you very much!

 

Wouldn't it be nice to open files/folders immediately from Alfred, within having to use the Finder window?

Similiar to the "open {query}" keyword shortcut.

 

Like so:

subl MySite (open the MySites folder with Sublime)

or

subl index.php (open index.php file with Sublime)

 

Unfortunately i'm not very good with AppleScript, otherwise i'd give it a try myself :(

Share this post


Link to post
Thank you very much!
 
Wouldn't it be nice to open files/folders immediately from Alfred, within having to use the Finder window?
Similiar to the "open {query}" keyword shortcut.
 
Like so:
subl MySite (open the MySites folder with Sublime)
or
subl index.php (open index.php file with Sublime)
 
Unfortunately i'm not very good with AppleScript, otherwise i'd give it a try myself :(

You should be able to do this by entering the complete POSIX path to the file after the `subl` keyword. So for example, I just tested:

subl "~/Dropbox/" "~/Documents/"

 

and it seemed to work fine. Does that give you any trouble on your end?

Share this post


Link to post

phyllisstein,

 

I've played a little bit with your workflow and boiled it down to a plain vanilla Alfred thing plus a trivial bash script which also addresses AMeijer's question (he actually wanted Alfred to select things him, I suppose).

 

Best,

Jan

 

Aha, I gotcha. That's actually a much more sensible way to do it! I'll have to see if I can't modify the shell script to check for ST2/3—not tonight, but soon.

Share this post


Link to post

Hey all! I've just made some small changes to the workflow so that it can take advantage of alp's fuzzy searching functions, making it a bit faster and smoother. Otherwise things are mostly unchanged. Download the update through Alleyoop or at http://alfred.daniel.sh/Workflows/OpenInSublime.alfredworkflow

 

The keywords are "subl" to list and open recent projects or the current Finder selection and "sub*" to do a Spotlight search for any file and pass it to Sublime. There's also an optional hotkey to open the Finder selection in Sublime immediately (mine's set to "⌥+⌘+↓").

Edited by phyllisstein

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...