Skip to content

Commit

Permalink
Merge branch 'release/v2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
deanishe committed Jun 16, 2014
2 parents af86576 + 885bd44 commit 9b79a55
Show file tree
Hide file tree
Showing 15 changed files with 1,343 additions and 34 deletions.
Binary file added Exclude.sketch/Data
Binary file not shown.
18 changes: 18 additions & 0 deletions Exclude.sketch/metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>app</key>
<string>com.bohemiancoding.sketch3</string>
<key>build</key>
<integer>7799</integer>
<key>commit</key>
<string>e645bc992e78ea0d8f54ab21bcdc83987015d34b</string>
<key>fonts</key>
<array/>
<key>length</key>
<integer>63693</integer>
<key>version</key>
<integer>36</integer>
</dict>
</plist>
1 change: 1 addition & 0 deletions Exclude.sketch/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
36
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ Download the workflow from [GitHub](https://github.com/deanishe/alfred-sublime-t

## Usage ##

Enter the keyword `.st` (the default—you can change it) in Alfred and an optional query.
- `.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

Hit `` on a result to open it in Sublime Text or `⌘+` to reveal in Finder.
**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 ##

Expand Down
Binary file modified Sublime Text Projects.alfredworkflow
Binary file not shown.
8 changes: 8 additions & 0 deletions TODO.taskpaper
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Updating:
- Re-jigger caching/filtering behaviour?
Currently, `locate` results are purged before caching. This means that files on disks currently not connected will disappear for up to a week. Is it better to store all the results and filter them on retrieval (in `sublime.py`) or will `mdfind` likely pick them up?
- Is an option to force reload from `locate` a viable alternative?
Probably!
Interface:
- Offer a way to edit `settings.json` via Alfred?
Lots of work, and anyone using Sublime Text should, nay must, be able to handle editing a JSON file. Not much of an ST user if you can't…
Binary file added src/Exclude.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
766 changes: 766 additions & 0 deletions src/Help.html

Large diffs are not rendered by default.

97 changes: 97 additions & 0 deletions src/Help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
title: Sublime Text Projects for Alfred 2 Help

# Sublime Text Projects for Alfred 2 #

View, filter and open Sublime Text (2 and 3) projects files saved on your Mac.

![](https://raw.githubusercontent.com/deanishe/alfred-sublime-text/master/demo.gif "")

- [Usage](#usage)
- [How it works](#howitworks)
+ [Excludes](#excludes)
+ [find](#find)
+ [locate](#locate)
* [Turning on locate](#turningonlocate)
* [Forcing an update](#forcinganupdate)
- [Settings](#settings)

## 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 this 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.

## How it works ##

By default, the workflow uses `mdfind` (which in turn uses Spotlight's index) to find all the `.sublime-project` files on your system.

Unfortunately, `mdfind` won't find hidden files or files in hidden directories. Thus, you can also add additional search directories, which will be searched for `.sublime-project` files using `find`, and/or turn on the `locate` database.

**Note**: Although it can take several seconds to perform the search with `find` and/or `locate`, the results are cached and the cache is updated in the background, so the Workflow will always remain responsive, although it might take a few seconds for newly-added files to show up in the results.

### Excludes ###

As `locate` in particular will likely return a lot of results you don't want to see, such as `.sublime-project` files that are part of apps' bundles, you can also add globbing patterns to the `settings.json` file, and paths that match these patterns will be ignored.

See [Settings](#settings) for more details.

### find ###

`find` is a common UNIX command for recursively searching directories. In contrast to `mdfind` and `locate`, it does not use a pre-compiled database, so it shouldn't be used on large directory hierarchies. `locate` (see [below](#locate)) is a better option for such directories. Unfortunately, the `locate` database is updated infrequently, so you might want to consider [forcing an update](#forcinganupdate).

By default, the directories `~/.config` and `~/.dotfiles` are added to the configuration, but will be ignored if they don't exist.

### locate ###

`locate` is a common UNIX command that maintains a list of all files on your system to enable (relatively) fast searching.

By default, its database is only updated once a week (on Saturdays at 3.15 a.m. on OSX). It is *a lot* slower than `mdfind` (which uses the Spotlight index), but also indexes hidden files.

So, if you have Sublime Project files stored in hidden directories, you might want to consider turning on `locate`.

#### Turning on locate ####

Execute the following command in `Terminal` to activate `locate`:

```
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
```

#### Forcing an update ####

Execute the following command in `Terminal` to force an update of the `locate` database:

```
sudo /usr/libexec/locate.updatedb
```

## Settings ##

The workflow configuration is stored in `setttings.json` in the Workflow's data directory. It's assumed that as a user of Sublime Text, you know how to edit a JSON file ;)

You can view the settings (and open `settings.json` in your editor) by entering `.stconfig` in Alfred.

The default config file looks like this:

```
{
"excludes": [
"/Applications/*.app/*"
],
"locatedb_cached": 0,
"search_directories": [
"~/.dotfiles",
"~/.config"
]
}
```

Add [globbing patterns](https://docs.python.org/2/library/fnmatch.html#module-fnmatch) to the `excludes` list to remove them from the results.

Add hidden directories to `search_directories` if you want them to be searched, too.

**Note**: Hidden directories will be searched with `find`, so don't add large directory hierarchies.
167 changes: 167 additions & 0 deletions src/info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,39 @@
<string>Reveal in Finder</string>
</dict>
</array>
<key>1958F9DC-5B69-4F0C-B4DC-FCBAE0AB1EF8</key>
<array>
<dict>
<key>destinationuid</key>
<string>0F77272E-39A5-44AD-BB24-462F199B5590</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
<key>36EE8FBB-FCCE-483E-AFCE-AC73906117C3</key>
<array>
<dict>
<key>destinationuid</key>
<string>31AB2913-1B83-4976-BE10-2526F543F5E3</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
<key>9981F708-6C83-44CD-BC06-B6C10A2B00F6</key>
<array>
<dict>
<key>destinationuid</key>
<string>1958F9DC-5B69-4F0C-B4DC-FCBAE0AB1EF8</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
</dict>
<key>createdby</key>
<string>Dean Jackson</string>
Expand Down Expand Up @@ -83,6 +116,115 @@
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>/usr/bin/python sublime.py --action "{query}"</string>
<key>type</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>1958F9DC-5B69-4F0C-B4DC-FCBAE0AB1EF8</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>lastpathcomponent</key>
<false/>
<key>onlyshowifquerypopulated</key>
<false/>
<key>output</key>
<integer>0</integer>
<key>removeextension</key>
<false/>
<key>sticky</key>
<false/>
<key>text</key>
<string>{query}</string>
<key>title</key>
<string>Sublime Projects</string>
</dict>
<key>type</key>
<string>alfred.workflow.output.notification</string>
<key>uid</key>
<string>0F77272E-39A5-44AD-BB24-462F199B5590</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>2</integer>
<key>escaping</key>
<integer>127</integer>
<key>keyword</key>
<string>.stconfig</string>
<key>runningsubtext</key>
<string>Reading settings…</string>
<key>script</key>
<string>/usr/bin/python sublime.py --action config</string>
<key>subtext</key>
<string>View and edit workflow settings</string>
<key>title</key>
<string>Settings for Sublime Text Projects</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>9981F708-6C83-44CD-BC06-B6C10A2B00F6</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>2</integer>
<key>keyword</key>
<string>.sthelp</string>
<key>subtext</key>
<string>View the help file for this Workflow</string>
<key>text</key>
<string>Sublime Text Projects Help</string>
<key>withspace</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.input.keyword</string>
<key>uid</key>
<string>36EE8FBB-FCCE-483E-AFCE-AC73906117C3</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>escaping</key>
<integer>127</integer>
<key>script</key>
<string>open ./Help.html</string>
<key>type</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>31AB2913-1B83-4976-BE10-2526F543F5E3</string>
<key>version</key>
<integer>0</integer>
</dict>
</array>
<key>readme</key>
<string></string>
Expand All @@ -93,11 +235,36 @@
<key>ypos</key>
<real>10</real>
</dict>
<key>0F77272E-39A5-44AD-BB24-462F199B5590</key>
<dict>
<key>ypos</key>
<real>250</real>
</dict>
<key>1958F9DC-5B69-4F0C-B4DC-FCBAE0AB1EF8</key>
<dict>
<key>ypos</key>
<real>250</real>
</dict>
<key>1F8CC3FB-B3D4-4FCB-B929-EB7E6E186DCD</key>
<dict>
<key>ypos</key>
<real>10</real>
</dict>
<key>31AB2913-1B83-4976-BE10-2526F543F5E3</key>
<dict>
<key>ypos</key>
<real>370</real>
</dict>
<key>36EE8FBB-FCCE-483E-AFCE-AC73906117C3</key>
<dict>
<key>ypos</key>
<real>370</real>
</dict>
<key>9981F708-6C83-44CD-BC06-B6C10A2B00F6</key>
<dict>
<key>ypos</key>
<real>250</real>
</dict>
<key>E934D964-B0B8-4A32-8DF3-4692A8F26E97</key>
<dict>
<key>ypos</key>
Expand Down
Loading

0 comments on commit 9b79a55

Please sign in to comment.