├── .gitignore ├── Context.sublime-menu ├── Default (OSX).sublime-keymap ├── Default (Linux).sublime-keymap ├── Default (Windows).sublime-keymap ├── messages.json ├── Default.sublime-commands ├── messages ├── 1.1.1.txt ├── 1.1.0.txt └── install.txt ├── devdocs.py └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.pyc 3 | -------------------------------------------------------------------------------- /Context.sublime-menu: -------------------------------------------------------------------------------- 1 | [ 2 | { "caption": "-"}, 3 | { "command": "dev_docs_search_selection", "caption": "Search DevDocs" } 4 | ] -------------------------------------------------------------------------------- /Default (OSX).sublime-keymap: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "keys": ["alt+shift+d"], "command": "dev_docs_search_from_input" 4 | } 5 | ] 6 | -------------------------------------------------------------------------------- /Default (Linux).sublime-keymap: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "keys": ["alt+shift+d"], "command": "dev_docs_search_from_input" 4 | } 5 | ] 6 | -------------------------------------------------------------------------------- /Default (Windows).sublime-keymap: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "keys": ["alt+shift+d"], "command": "dev_docs_search_from_input" 4 | } 5 | ] 6 | -------------------------------------------------------------------------------- /messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "install": "messages/install.txt", 3 | "1.1.0": "messages/1.1.0.txt", 4 | "1.1.1": "messages/1.1.1.txt" 5 | } 6 | -------------------------------------------------------------------------------- /Default.sublime-commands: -------------------------------------------------------------------------------- 1 | [ 2 | { "command": "dev_docs_search_selection", "caption": "DevDocs: Search From Selection" }, 3 | { "command": "dev_docs_search_from_input", "caption": "DevDocs: Search From Input" } 4 | ] 5 | -------------------------------------------------------------------------------- /messages/1.1.1.txt: -------------------------------------------------------------------------------- 1 | DevDocs 1.1.1 changelog 2 | ============================= 3 | 4 | CHANGES/FIXES 5 | ------------- 6 | - Fixed problem with shortcuts 7 | 8 | 9 | Support 10 | ======= 11 | 12 | Please direct any feedback to code@vitorbritto.com.br or through github at https://github.com/vitorbritto/sublime-devdocs. 13 | 14 | Thank you for your support. 15 | -------------------------------------------------------------------------------- /messages/1.1.0.txt: -------------------------------------------------------------------------------- 1 | DevDocs 1.1.0 changelog 2 | ============================= 3 | 4 | CHANGES/FIXES 5 | ------------- 6 | - Fixed problem with hidden menus 7 | - Apologizing for hasty v1.0.0 release ;) 8 | 9 | NEW FEATURES 10 | ------------ 11 | - Added "Search by selection" and "Search by input" sections to the README 12 | - Added shortcut for "Search by input" 13 | - New menu on the (Sublime Text) Command Palette 14 | 15 | 16 | Support 17 | ======= 18 | 19 | Please direct any feedback to code@vitorbritto.com.br or through github at https://github.com/vitorbritto/sublime-devdocs. 20 | 21 | Thank you for your support. -------------------------------------------------------------------------------- /messages/install.txt: -------------------------------------------------------------------------------- 1 | DevDocs 2 | ======= 3 | 4 | Very simple search on DevDocs by Vitor Britto (code@vitorbritto.com.br / vitorbritto.com.br) 5 | 6 | 7 | Customization 8 | ============= 9 | 10 | Include this in the user key binding to overwrite default behaviour 11 | 12 | { "keys": ["ctrl+shift+d"], "command": "dev_docs_search_selection" } 13 | 14 | 15 | Usage 16 | ===== 17 | 18 | Highlight text, right click & click "Search DevDocs" to open a new tab on your web browser with the info. You can also use the shortcut. 19 | 20 | 21 | Support 22 | ======= 23 | 24 | Please direct any feedback to code@vitorbritto.com.br or through github at https://github.com/vitorbritto/sublime-devdocs. 25 | 26 | Thank you for your support. 27 | 28 | Vitor Britto 29 | 30 | -------------------------------------------------------------------------------- /devdocs.py: -------------------------------------------------------------------------------- 1 | # Written by Vitor Britto (code@vitorbritto.com.br / vitorbritto.com.br) 2 | # based on Stackoverflow Search Plugin by Eric Martel (emartel@gmail.com / www.ericmartel.com) 3 | 4 | import sublime 5 | import sublime_plugin 6 | 7 | import subprocess 8 | import webbrowser 9 | 10 | 11 | def SearchFor(text): 12 | url = 'http://devdocs.io/#q=' + text.replace(' ', '%20') 13 | webbrowser.open_new_tab(url) 14 | 15 | 16 | class DevDocsSearchSelectionCommand(sublime_plugin.TextCommand): 17 | def run(self, edit): 18 | for selection in self.view.sel(): 19 | # if the user didn't select anything, search the currently highlighted word 20 | if selection.empty(): 21 | text = self.view.word(selection) 22 | 23 | text = self.view.substr(selection) 24 | SearchFor(text) 25 | 26 | 27 | class DevDocsSearchFromInputCommand(sublime_plugin.WindowCommand): 28 | def run(self): 29 | # Get the search item 30 | self.window.show_input_panel('Search DevDocs for', '', 31 | self.on_done, self.on_change, self.on_cancel) 32 | 33 | def on_done(self, input): 34 | SearchFor(input) 35 | 36 | def on_change(self, input): 37 | pass 38 | 39 | def on_cancel(self): 40 | pass -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Search DevDocs 2 | 3 | 4 | ## About 5 | This is a [Sublime Text](http://www.sublimetext.com) plugin allowing you to easily search the DevDocs documentation. 6 | 7 | The plugin code is based on the [Stackoverflow Plugin](https://github.com/ericmartel/Sublime-Text-2-Stackoverflow-Plugin) script by Eric Martel. 8 | 9 | 10 | ## Usage 11 | 12 | ### Search by selection 13 | Highlight text, right click & click "Search DevDocs" to open a new tab on your web browser with the info. 14 | 15 | ### Search by input 16 | 1. Open your command pallete with `ctrl + shift + p` (Linux/Windows) or `cmd + shift + p` (OS X) 17 | 2. Type "devdocs" 18 | 3. Click on "Search From Input" 19 | 4. Type your keyword 20 | 21 | ***You can also use the shortcut (`ctrl + shift + d`).*** 22 | 23 | > To search a specific documentation, type its name and a space before your keyword. (e.g: js date) 24 | 25 | 26 | ## Installation 27 | The easiest way to install this is with [Package Control](http://wbond.net/sublime\_packages/package\_control). 28 | 29 | * If you just went and installed Package Control, you probably need to restart Sublime Text 2 before doing this next bit. 30 | * Bring up the Command Palette (Command+Shift+p on OS X, Control+Shift+p on Linux/Windows). 31 | * Select "Package Control: Install Package" (it'll take a few seconds) 32 | * Select DevDocs when the list appears. 33 | 34 | Package Control will automatically keep Git up to date with the latest version. 35 | 36 | If you have some problems or improvements with it, [contact me](https://github.com/vitorbritto/sublime-devdocs/issues) via GitHub. 37 | 38 | 39 | ## License 40 | 41 | [MIT License](http://vitorbritto.mit-license.org/) © Vitor Britto 42 | --------------------------------------------------------------------------------