├── .gitignore ├── README.md ├── Sublime Text Projects.alfredworkflow └── sublime.php /.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigluck/alfred2-sublimeprojects/f1236efa879eef11aafa47a66c7a7d500fbbf8bd/.gitignore -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Sublime Projects for Alfred 2 2 | ============ 3 | 4 | A simple but useful Alfred 2 workflow with Sublime Projects support. 5 | 6 | 7 | Requirements 8 | ---------------- 9 | You have to install the `subl` command line tool. 10 | 11 | - Instructions for [Sublime Text 3](http://www.sublimetext.com/docs/3/osx_command_line.html) 12 | - Instructions for [Sublime Text 2](http://www.sublimetext.com/docs/2/osx_command_line.html) 13 | 14 | 15 | Installation 16 | ---------------- 17 | 18 | - Download "Sublime Text Projects.alfredworkflow" extension by clicking the "raw" link. 19 | - Double click the *.alfredextension file to install. 20 | 21 | 22 | Instructions 23 | ---------------- 24 | 25 | sub `` 26 | 27 | 28 | Fuzzy-ish type maching 29 | ---------------- 30 | 31 | Thanks to [natecavanaugh](https://github.com/natecavanaugh) contribute now are allowed a fuzzy-ish type matching of the names of projects; for instance, if you have 3 projects such as: 32 | 33 | - dotfiles 34 | - Liferay Dev 35 | - Liferay Plugins 36 | 37 | Typing `de` will give you `dotfiles` and `Liferay Dev`. 38 | Typing `lfr` will give you both `Liferay Dev` and `Liferay Plugins`. 39 | Typing `ldev` will give you just `Liferay Dev`. 40 | 41 | This fits more with how fuzzy matching is done in Sublime and makes it really easy to select projects. -------------------------------------------------------------------------------- /Sublime Text Projects.alfredworkflow: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigluck/alfred2-sublimeprojects/f1236efa879eef11aafa47a66c7a7d500fbbf8bd/Sublime Text Projects.alfredworkflow -------------------------------------------------------------------------------- /sublime.php: -------------------------------------------------------------------------------- 1 | $path, 24 | 'arg' => $path, 25 | 'title' => basename($path, '.'.$pathInfo['extension']), 26 | 'subtitle' => 'Open (new window) or ⌘ (append) ', 27 | 'icon' => 'icon.png', 28 | 'valid' => true); 29 | } 30 | 31 | // No favorites matched 32 | if (!count($results)) 33 | $results[] = array( 34 | 'uid' => 'none', 35 | 'arg' => 'none', 36 | 'title' => 'No Favorites Found', 37 | 'subtitle' => 'No favorites matching your query were found', 38 | 'icon' => 'icon.png', 39 | 'valid' => false); 40 | 41 | 42 | // Preparing the XML output file 43 | $xmlObject = new SimpleXMLElement(""); 44 | foreach($results AS $rows) 45 | { 46 | $nodeObject = $xmlObject->addChild('item'); 47 | $nodeKeys = array_keys($rows); 48 | foreach ($nodeKeys AS $key) 49 | $nodeObject->{ $key == 'uid' || $key == 'arg' ? 'addAttribute' : 'addChild' }($key, $rows[$key]); 50 | } 51 | 52 | // Print the XML output 53 | echo $xmlObject->asXML(); 54 | 55 | ?> 56 | --------------------------------------------------------------------------------