Jump to content

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.

Link to comment
  • 2 weeks later...
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}"`.

Link to comment
  • 1 month later...
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 :(
Link to comment
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?

Link to comment

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.

Link to comment
  • 1 month later...

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
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...