├── .gitignore ├── Default.sublime-commands ├── README.md └── ReadmePlease.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.sublime-project 3 | *.sublime-workspace -------------------------------------------------------------------------------- /Default.sublime-commands: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "caption": "ReadmePlease", 4 | "command": "readme_please" 5 | } 6 | ] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ReadmePlease 2 | =========== 3 | 4 | Overview 5 | -------- 6 | 7 | ReadmePlease is a [Sublime Text 2/3](http://www.sublimetext.com/) plugin for quick access to README files of installed packages. See below for installation instructions. 8 | 9 | Installation 10 | ------------ 11 | 12 | * via [PackageControl](http://wbond.net/sublime_packages/package_control) 13 | 14 | or 15 | 16 | * clone to your Sublime Text 2/3 `Packages` folder located at 17 | * Windows: %APPDATA%\Sublime Text 3 18 | * OS X: ~/Library/Application Support/Sublime Text 3 19 | * Linux: ~/.config/sublime-text-3 20 | 21 | 22 | Usage 23 | ------- 24 | 25 | Enter `ReadmePlease` in command palette 26 | 27 | 28 | Contributors 29 | ----------- 30 | 31 | Created by Aliaksei Shytkin [roadhump](https://twitter.com/roadhump) 32 | Updated for st3 by Eric West [edubkendo](https://github.com/edubkendo) 33 | -------------------------------------------------------------------------------- /ReadmePlease.py: -------------------------------------------------------------------------------- 1 | import sublime 2 | import sublime_plugin 3 | 4 | import sys 5 | 6 | # On Windows and OSX, with (commonly) case-insensitive file systems, 7 | # don't bother trying different upper-/lower-case spellings 8 | if sys.platform in ('win32', 'darwin'): 9 | README_PATTERNS = ['readme.*'] 10 | else: 11 | README_PATTERNS = ["readme.*", "README.*", "Readme.*", "ReadMe.*"] 12 | 13 | 14 | class ReadmePleaseCommand(sublime_plugin.WindowCommand): 15 | 16 | def description(self): 17 | """Quick access to packages README.""" 18 | 19 | def run(self): 20 | 21 | self.helps = [] 22 | 23 | for spelling in README_PATTERNS: 24 | for path in sublime.find_resources(spelling): 25 | components = path.split('/') 26 | if len(components) == 3: # exclude files in package subdirs 27 | package_name, readme_name = components[-2:] 28 | self.helps.append([package_name, readme_name, path]) 29 | 30 | self.helps.sort() 31 | self.window.show_quick_panel(list(map( 32 | lambda x: [x[0], x[1]], self.helps)), self.onSelect) 33 | 34 | def onSelect(self, i): 35 | if (i != -1): 36 | help = self.helps[i] 37 | 38 | sublime.active_window().run_command("open_file", { 39 | "file": "${packages}/%s/%s" % (help[0], help[1])}) 40 | --------------------------------------------------------------------------------