Jump to content

Recommended Posts

Sublime Text Projects

Filter and open your Sublime Text (2 and 3) project files. It can be tricky getting .sublime-project files to work with File Filters, as Sublime Text doesn't register the extension as a proper filetype. This workflow solves that problem.

It can easily be duplicated and adapted to other filetypes with the same problem.

Note: The new version (2014-06-16) also finds files in hidden directories (with a little configuration).

demo.gif

Installation

Download the workflow from GitHub or Packal.

Usage

  • .st [<query>] — List/filter your .sublime-project files
  • — Open result in Sublime Text
  • ⌘+↩ — Reveal file in Finder
  • .stconfig — Show the current settings
  • .sthelp — View the included help file
Note: You can currently only alter the settings by editing the settings.json file by hand. Hit on the Edit Configuration item to open it in your default JSON editor.

Licensing, thanks

All the code is released under the MIT Licence.

The icons are by dmatarazzo.

Changelog

2014-06-16 

  • Add ability to search in hidden directories and other directories excluded from Spotlight's index
  • Add ability to filter out certain results (via globbing patterns)
  • Add ability to get your hands dirty editing the JSON config file :)
Edited by deanishe

Share this post


Link to post

Significant update. See OP.

No longer as simple (to write) as I'd hoped, but the workflow now supports finding files in hidden directories.

Share this post


Link to post
Thank you for this workflow !

 

The problem is when a project is launched by this workflow the workspace is empty.

It would be great if we could have the previous state of workspace, like "subl my-project.sublime-project" command in a terminal session

Share this post


Link to post
That would be ideal, but the problem with that is it would require that the subl command has been linked to /usr/local/bin/.

 

It could use subl from within the application bundle, but what is the workflow supposed to do if both ST2 and ST3 are installed?

 

The workflow will open the .sublime-project file with whatever application you have set to open that type of file.

 

So if you want that to be the subl command, create an application with Automator with a Run Shell Script action that calls subl with the passed file.

 

Set that as the default application for .sublime-project files and it will have the added advantage of also restoring the workspace when double-clicking a .sublime-project file in Finder.

Edited by deanishe

Share this post


Link to post

 

That would be ideal, but the problem with that is it would require that the subl command has been linked to /usr/local/bin/.
 
It could use subl from within the application bundle, but what is the workflow supposed to do if both ST2 and ST3 are installed?
 
The workflow will open the .sublime-project file with whatever application you have set to open that type of file.
 
So if you want that to be the subl command, create an application with Automator with a Run Shell Script action that calls subl with the passed file.
 
Set that as the default application for .sublime-project files and it will have the added advantage of also restoring the workspace when double-clicking a .sublime-project file in Finder.

 

 

 

Thanks for that tip! Makes this workflow really awesome. Can you include it on the Packal page?

Share this post


Link to post

Yes. Alfred-Workflow's background API doesn't get along with Sierra.

 

I'm at a bit of a loss as to how to fix it, as I don't have Sierra, so I can't reproduce the problem.

Share this post


Link to post

@deanishe hey, I am using your sublime workflow for a long time. 

 

May I ask you that how do I change it a bit, so the default sublime text option opens a new sublime text window for me on my current desktop

Now whenever I hit enter it will point me to my already opened sublime window. 

 

Thanks in advance. 

Share this post


Link to post
33 minutes ago, deanishe said:

The answer to your question is a few posts above yours. 

You got me confused... your workflow above, (in the original post ) if I've already had a sublime window opened, can only direct me to my existing sublime text window. 

 

I need the workflow to open new blank window everytime I key in: sublime. 

 

Could you make one workflow that does these: 

  1. whenever keyed in: subl, open new blank sublime window in the active desktop. No matter whether the app is already opened. 
  2. open with sublime text (just like the old one)
  3. find and open with sublime text (just like the old one)

 

Share this post


Link to post

Sorry. I was half-awake and misread your question.

 

7 hours ago, mrchow19910319 said:

Could you make one workflow that does these: 

 

No. But this script does what you want:

tell application "Sublime Text"
	if it is running then
		tell application "System Events"
			tell process "Sublime Text" to click menu item "New Window" in menu "File" of menu bar 1
		end tell
	end if
end tell
-- Activate doesn't work with Sublime on Sierra
do shell script "open -a 'Sublime Text'"

 

Share this post


Link to post
5 hours ago, deanishe said:

Sorry. I was half-awake and misread your question.

 

 

No. But this script does what you want:


tell application "Sublime Text"
	if it is running then
		tell application "System Events"
			tell process "Sublime Text" to click menu item "New Window" in menu "File" of menu bar 1
		end tell
	end if
end tell
-- Activate doesn't work with Sublime on Sierra
do shell script "open -a 'Sublime Text'"

 

Okay this worked. Thank you so much! 

Edited by mrchow19910319

Share this post


Link to post

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
×