├── .gitignore ├── Default (Linux).sublime-keymap ├── Default (OSX).sublime-keymap ├── Default (Windows).sublime-keymap ├── OpenPath (Linux).sublime-settings ├── OpenPath (OSX).sublime-settings ├── OpenPath (Windows).sublime-settings ├── OpenPath.sublime-commands ├── OpenPath.sublime-settings ├── license.md ├── open_path.py ├── package-metadata.json └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc -------------------------------------------------------------------------------- /Default (Linux).sublime-keymap: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "keys": ["f10"], 4 | "command": "open_project_folder", 5 | "context": [ 6 | {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true}, 7 | ] 8 | }, 9 | 10 | { 11 | "keys": ["ctrl+f10"], 12 | "command": "open_file_folder", 13 | "context": [ 14 | {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true}, 15 | ] 16 | } 17 | ] -------------------------------------------------------------------------------- /Default (OSX).sublime-keymap: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "keys": ["f10"], 4 | "command": "open_project_folder", 5 | "context": [ 6 | {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true}, 7 | ] 8 | }, 9 | 10 | { 11 | "keys": ["ctrl+f10"], 12 | "command": "open_file_folder", 13 | "context": [ 14 | {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true}, 15 | ] 16 | } 17 | ] -------------------------------------------------------------------------------- /Default (Windows).sublime-keymap: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "keys": ["f10"], 4 | "command": "open_project_folder", 5 | "context": [ 6 | {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true} 7 | ] 8 | }, 9 | 10 | { 11 | "keys": ["ctrl+f10"], 12 | "command": "open_file_folder", 13 | "context": [ 14 | {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true} 15 | ] 16 | } 17 | ] 18 | -------------------------------------------------------------------------------- /OpenPath (Linux).sublime-settings: -------------------------------------------------------------------------------- 1 | // As always, please edit User.sublime-settings rather than this file. 2 | { 3 | "file_manager": "xdg-open '{0}'&" 4 | } 5 | -------------------------------------------------------------------------------- /OpenPath (OSX).sublime-settings: -------------------------------------------------------------------------------- 1 | // As always, please edit User.sublime-settings rather than this file. 2 | { 3 | "file_manager": "open '{0}'" 4 | } 5 | -------------------------------------------------------------------------------- /OpenPath (Windows).sublime-settings: -------------------------------------------------------------------------------- 1 | // As always, please edit User.sublime-settings rather than this file. 2 | { 3 | "file_manager": "explorer /e /root,\"{0}\"" 4 | } 5 | -------------------------------------------------------------------------------- /OpenPath.sublime-commands: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "caption": "OpenPath: Open project folder", 4 | "command": "open_project_folder" 5 | }, 6 | 7 | { 8 | "caption": "OpenPath: Open file folder", 9 | "command": "open_file_folder" 10 | } 11 | ] -------------------------------------------------------------------------------- /OpenPath.sublime-settings: -------------------------------------------------------------------------------- 1 | { 2 | "file_manager": "xdg-open" 3 | } 4 | -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- 1 | # License 2 | 3 | The MIT License (MIT) 4 | 5 | Copyright (c) 2014 Leonid Shagabutdinov 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. -------------------------------------------------------------------------------- /open_path.py: -------------------------------------------------------------------------------- 1 | import sublime, sublime_plugin, os 2 | from subprocess import call 3 | 4 | def open_path(folder): 5 | settings = sublime.load_settings("OpenPath.sublime-settings") 6 | file_manager = settings.get("file_manager", "explorer /e /root,\"{0}\"") 7 | command = file_manager.format(folder) 8 | call(command, shell=True) 9 | 10 | class OpenPath(sublime_plugin.WindowCommand): 11 | def run(self, path): 12 | open_path(path) 13 | 14 | class OpenProjectFolder(sublime_plugin.WindowCommand): 15 | def run(self): 16 | if len(self.window.folders()) == 0: 17 | return 18 | 19 | open_path(self.window.folders()[0]) 20 | 21 | class OpenFileFolder(sublime_plugin.WindowCommand): 22 | def run(self): 23 | if self.window.active_view() is None: 24 | return 25 | 26 | open_path(os.path.dirname(self.window.active_view().file_name())) -------------------------------------------------------------------------------- /package-metadata.json: -------------------------------------------------------------------------------- 1 | {"url": "https://github.com/shagabutdinov/sublime-open-path", "version": "2012.12.21.04.47.26", "description": "Sublime open file/project folder"} -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Sublime OpenPath plugin 2 | 3 | Open path in file browser by shortcut and provide API for other plugins to open 4 | file browser in os-independent way. Based on [openfolder](https://github.com/mikepfirrmann/openfolder) 5 | plugin so all cheers to original author. 6 | 7 | 8 | ### Installation 9 | 10 | This plugin is part of [sublime-enhanced](http://github.com/shagabutdinov/sublime-enhanced) 11 | plugin set. You can install sublime-enhanced and this plugin will be installed 12 | automatically. 13 | 14 | If you would like to install this package separately check "Installing packages 15 | separately" section of [sublime-enhanced](http://github.com/shagabutdinov/sublime-enhanced) 16 | package. 17 | 18 | 19 | ### Features 20 | 21 | - Open project folder in file browser by hitting shortcut 22 | 23 | - Open current file folder in file browser by hitting shortcut 24 | 25 | - Providing open_path python module for external plugins 26 | 27 | 28 | ### Usage 29 | 30 | Hit keyboard shortcut to open project or file folder. Map often-used opened 31 | folders to your keymap file (command "open_path", {"path": "/home/leo"}). 32 | 33 | 34 | ### Commands 35 | 36 | | Description | Keyboard shortcuts | Command palette | 37 | |---------------------|--------------------|-------------------------------| 38 | | Open project folder | f10 | OpenPath: Open project folder | 39 | | Open file folder | ctrl+f10 | OpenPath: Open file folder | 40 | 41 | ## Customize shortcuts 42 | 43 | Open preferences->key bindings->user and add your own shortcuts example: 44 | 45 | {"keys": ["alt+e"], "command": "open_file_folder"}, 46 | {"keys": ["ctrl+alt+e"], "command": "open_project_folder"} 47 | 48 | ### Dependencies 49 | 50 | None 51 | 52 | 53 | ### API 54 | 55 | OpenPath.open_path: 56 | 57 | 58 | ##### open_path(path) 59 | 60 | Opens given path in file manager. 61 | --------------------------------------------------------------------------------