├── __init__.py ├── layers ├── __init__.py ├── core │ ├── __init__.py │ ├── README.md │ ├── commands.py │ ├── settings.py │ └── layer.py ├── git │ ├── __init__.py │ ├── settings.py │ ├── README.md │ └── layer.py ├── go │ ├── __init__.py │ ├── settings.py │ └── layer.py ├── osx │ ├── __init__.py │ ├── settings.py │ ├── README.md │ └── layer.py ├── php │ ├── __init__.py │ ├── settings.py │ ├── layer.py │ └── README.md ├── clojure │ ├── __init__.py │ ├── settings.py │ ├── README.md │ └── layer.py ├── coffee │ ├── __init__.py │ ├── settings.py │ ├── README.md │ └── layer.py ├── elixir │ ├── __init__.py │ ├── settings.py │ ├── README.md │ └── layer.py ├── markdown │ ├── __init__.py │ ├── settings.py │ ├── README.md │ └── layer.py ├── python │ ├── __init__.py │ ├── settings.py │ ├── README.md │ └── layer.py └── javascript │ ├── __init__.py │ ├── settings.py │ ├── README.md │ └── layer.py ├── lib ├── __init__.py ├── editor_commands.py ├── io.py ├── helpers.py ├── package_resolver.py ├── package_controller.py └── collector.py ├── .no-sublime-package ├── setup.cfg ├── .gitignore ├── messages.json ├── keyhelper ├── keyhelper.sublime-syntax └── keyhelper.tmTheme ├── sublimious.sublime-project ├── command_importer.py ├── messages └── install.txt ├── commands.py ├── templates └── .sublimious ├── .github └── CONTRIBUTING.md ├── README.md ├── sublimious.py ├── spacelistener.py └── LICENSE /__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layers/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.no-sublime-package: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layers/core/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layers/git/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layers/go/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layers/osx/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layers/php/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layers/clojure/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layers/coffee/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layers/elixir/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layers/go/settings.py: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /layers/markdown/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layers/python/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layers/clojure/settings.py: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /layers/coffee/settings.py: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /layers/elixir/settings.py: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /layers/javascript/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /layers/osx/settings.py: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /layers/php/settings.py: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /layers/python/settings.py: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [pep8] 2 | ignore = E501 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.sublime-settings 2 | *.sublime-keymap 3 | -------------------------------------------------------------------------------- /messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "install": "messages/install.txt", 3 | } 4 | -------------------------------------------------------------------------------- /layers/osx/README.md: -------------------------------------------------------------------------------- 1 | # OSX Layer 2 | 3 | fixes some quirks when using mac. Nothing special yet. 4 | -------------------------------------------------------------------------------- /layers/elixir/README.md: -------------------------------------------------------------------------------- 1 | # Elixir Layer 2 | 3 | Layer for adding elixir syntax highlighting 4 | 5 | ## Configuration 6 | 7 | None yet 8 | -------------------------------------------------------------------------------- /layers/markdown/settings.py: -------------------------------------------------------------------------------- 1 | { 2 | "package_settings": { 3 | "Markdown": { 4 | "caret_style": "solid" 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /layers/javascript/settings.py: -------------------------------------------------------------------------------- 1 | { 2 | "package_settings": { 3 | "Tern": { 4 | "tern_command": ["node", "/usr/local/bin/tern"], 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /layers/markdown/README.md: -------------------------------------------------------------------------------- 1 | # Markdown Layer 2 | 3 | This layer gives you beautiful markdown editing with no configuration required. 4 | 5 | ## Configuration 6 | 7 | None yet 8 | -------------------------------------------------------------------------------- /layers/clojure/README.md: -------------------------------------------------------------------------------- 1 | # Clojure Layer 2 | 3 | Layer for adding clojure support 4 | 5 | ## Requirements 6 | 7 | None yet 8 | 9 | ## Configuration 10 | 11 | None yet 12 | -------------------------------------------------------------------------------- /layers/python/README.md: -------------------------------------------------------------------------------- 1 | # Python Layer 2 | 3 | Layer for adding python autocomplete, linting (through pep8), a REPL and more. 4 | 5 | ## Requirements 6 | 7 | - `flake8` 8 | - `pep8` 9 | - `jedi` 10 | 11 | ## Configuration 12 | 13 | None yet 14 | -------------------------------------------------------------------------------- /layers/coffee/README.md: -------------------------------------------------------------------------------- 1 | # CoffeeScript Layer 2 | 3 | Layer for adding coffeescript support 4 | 5 | ## Requirements 6 | 7 | - `coffee` (`npm install -g coffee`) 8 | - `coffeelint` (`npm install -g coffeelint`) 9 | 10 | ## Configuration 11 | 12 | None yet 13 | -------------------------------------------------------------------------------- /layers/core/README.md: -------------------------------------------------------------------------------- 1 | # Core Layer 2 | 3 | This layer is sublimious main layer and contains keybindings for almost everything. 4 | 5 | It is better you don't touch anything in here and keep your changes to the .sublimious config file :) 6 | 7 | ## Configuration 8 | 9 | None yet 10 | -------------------------------------------------------------------------------- /lib/editor_commands.py: -------------------------------------------------------------------------------- 1 | import sublime 2 | 3 | 4 | def show_console(): 5 | sublime.active_window().run_command("show_panel", {"panel": "console", "toggle": False}) 6 | 7 | 8 | def hide_console(): 9 | sublime.active_window().run_command("hide_panel", {"panel": "console", "toggle": False}) 10 | -------------------------------------------------------------------------------- /layers/osx/layer.py: -------------------------------------------------------------------------------- 1 | class Layer(): 2 | name = "OSX" 3 | 4 | required_packages = [ 5 | "Fix Mac Path", 6 | ] 7 | 8 | sublimious_keymap = [] 9 | sublime_keymap = [] 10 | syntax_definitions = {} 11 | color_scheme_definitions = {} 12 | 13 | def init(self, config): 14 | pass 15 | -------------------------------------------------------------------------------- /layers/git/settings.py: -------------------------------------------------------------------------------- 1 | { 2 | "package_settings": { 3 | "GitSavvy": { 4 | "show_commit_diff": True, 5 | "show_git_flow_commands": True, 6 | "git_status_in_status_bar": True, 7 | }, 8 | "GitGutter": { 9 | "show_status": "none", 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /layers/elixir/layer.py: -------------------------------------------------------------------------------- 1 | class Layer(): 2 | name = "Elixir" 3 | 4 | required_packages = [ 5 | "Elixir", 6 | "ElixirSublime" 7 | ] 8 | 9 | sublimious_keymap = [] 10 | sublime_keymap = [] 11 | 12 | syntax_definitions = { 13 | "Elixir": ['exs', 'ex'] 14 | } 15 | 16 | def init(self, config): 17 | pass 18 | -------------------------------------------------------------------------------- /keyhelper/keyhelper.sublime-syntax: -------------------------------------------------------------------------------- 1 | %YAML 1.2 2 | --- 3 | name: Keyhelper 4 | comment: sublimious keyhelper syntax 5 | scope: sublimious.source 6 | contexts: 7 | main: 8 | - match: (\[[a-zA-Z0-9_\/\<\>]*\]) 9 | scope: keybinding 10 | - match: (\+[a-zA-Z0-9_\/\<\>]*) 11 | scope: category 12 | - match: ([a-zA-Z0-9_\/\ ]*) 13 | scope: description 14 | -------------------------------------------------------------------------------- /sublimious.sublime-project: -------------------------------------------------------------------------------- 1 | { 2 | "build_systems": 3 | [ 4 | { 5 | "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", 6 | "name": "Anaconda Python Builder", 7 | "selector": "source.python", 8 | "shell_cmd": "python -u \"$file\"" 9 | } 10 | ], 11 | "folders": 12 | [ 13 | { 14 | "path": "." 15 | } 16 | ], 17 | "settings": { 18 | "pep8_ignore": ["E501"] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /layers/core/commands.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sublime 3 | import sublime_plugin 4 | 5 | 6 | class OpenSublimiousConfigCommand(sublime_plugin.WindowCommand): 7 | def run(self, *args, **kw): 8 | print("Opening .sublimious") 9 | config_path = os.path.expanduser("~/.sublimious") 10 | if os.path.exists(config_path): 11 | sublime.active_window().open_file(config_path) 12 | -------------------------------------------------------------------------------- /layers/php/layer.py: -------------------------------------------------------------------------------- 1 | class Layer(): 2 | name = "PHP" 3 | 4 | required_packages = [ 5 | "SublimeLinter-php", 6 | "Phpcs", 7 | # "Laravel Blade Highlighter" 8 | ] 9 | 10 | sublimious_keymap = [] 11 | sublime_keymap = [] 12 | 13 | syntax_definitions = { 14 | "PHP": ['php'], 15 | "laravel-blade": ['blade.php', 'blade'] 16 | } 17 | 18 | def init(self, config): 19 | pass 20 | -------------------------------------------------------------------------------- /layers/coffee/layer.py: -------------------------------------------------------------------------------- 1 | class Layer(): 2 | name = "CoffeeScript" 3 | 4 | required_packages = [ 5 | "SublimeREPL", 6 | "Better CoffeeScript", 7 | "CoffeeCompile", 8 | "SublimeLinter-coffeelint" 9 | ] 10 | 11 | sublimious_keymap = [] 12 | sublime_keymap = [] 13 | 14 | syntax_definitions = { 15 | "CoffeeScript": ['coffee'] 16 | } 17 | 18 | def init(self, config): 19 | pass 20 | -------------------------------------------------------------------------------- /layers/go/layer.py: -------------------------------------------------------------------------------- 1 | class Layer(): 2 | name = "Go" 3 | 4 | required_packages = [ 5 | "GoSublime", 6 | "SublimeLinter-contrib-golint", 7 | "SublimeLinter-contrib-govet", 8 | "SublimeLinter-contrib-gotype" 9 | ] 10 | 11 | sublimious_keymap = [] 12 | sublime_keymap = [] 13 | 14 | syntax_definitions = { 15 | "GoSublime-Go": ['go'] 16 | } 17 | 18 | def init(self, config): 19 | pass 20 | -------------------------------------------------------------------------------- /layers/clojure/layer.py: -------------------------------------------------------------------------------- 1 | class Layer(): 2 | name = "CoffeeScript" 3 | 4 | required_packages = [ 5 | "SublimeREPL", 6 | "Leiningen", 7 | "Enhanced Clojure", 8 | "ClojureDocSearch" 9 | ] 10 | 11 | sublimious_keymap = [] 12 | sublime_keymap = [] 13 | 14 | syntax_definitions = { 15 | "Clojure": ['clj'], 16 | "ClojureScript": ['cljs'] 17 | } 18 | 19 | def init(self, config): 20 | pass 21 | -------------------------------------------------------------------------------- /layers/python/layer.py: -------------------------------------------------------------------------------- 1 | class Layer(): 2 | name = "Python" 3 | 4 | required_packages = [ 5 | "Djaneiro", 6 | "Anaconda", 7 | "Python 3", 8 | "AutoPEP8", 9 | "SublimeREPL", 10 | ] 11 | 12 | sublimious_keymap = [] 13 | sublime_keymap = [] 14 | 15 | syntax_definitions = { 16 | "Python": ['py'], 17 | "Python3": [".sublimious"] 18 | } 19 | 20 | def init(self, config): 21 | pass 22 | -------------------------------------------------------------------------------- /layers/markdown/layer.py: -------------------------------------------------------------------------------- 1 | class Layer(): 2 | name = "Markdown" 3 | 4 | required_packages = [ 5 | "MarkdownEditing", 6 | ] 7 | 8 | sublimious_keymap = [] 9 | sublime_keymap = [] 10 | 11 | syntax_definitions = { 12 | "Markdown": ['md', 'mdown'] 13 | } 14 | 15 | color_scheme_definitions = { 16 | "Markdown": 'Packages/MarkdownEditing/MarkdownEditor-Dark.tmTheme', 17 | } 18 | 19 | def init(self, config): 20 | pass 21 | -------------------------------------------------------------------------------- /lib/io.py: -------------------------------------------------------------------------------- 1 | from importlib.machinery import SourceFileLoader 2 | 3 | 4 | def load_dictionary(path): 5 | return eval(open(path, 'r').read()) 6 | 7 | 8 | def load_python_file(path): 9 | return SourceFileLoader("", path).load_module() 10 | 11 | 12 | def write_sublimious_file(path, content): 13 | with open(path, "w") as f: 14 | f.write("// Generated by sublimious. Don't touch. \n") 15 | f.write("// Edit ~/.sublimious instead. \n") 16 | f.write(content) 17 | -------------------------------------------------------------------------------- /lib/helpers.py: -------------------------------------------------------------------------------- 1 | def mergedicts(a, b, path=None): 2 | "merges b into a" 3 | if path is None: 4 | path = [] 5 | 6 | for key in b: 7 | if key in a: 8 | if isinstance(a[key], dict) and isinstance(b[key], dict): 9 | mergedicts(a[key], b[key], path + [str(key)]) 10 | elif a[key] == b[key]: 11 | pass # same leaf value 12 | else: 13 | a[key] = b[key] 14 | else: 15 | a[key] = b[key] 16 | return a 17 | -------------------------------------------------------------------------------- /layers/php/README.md: -------------------------------------------------------------------------------- 1 | # PHP layer 2 | 3 | Layer for adding basic php support, linting, syntax highlighting and [phpcs](http://benmatselby.github.io/sublime-phpcs/) 4 | 5 | ## Requirements 6 | 7 | - php installed on your system (linting is done through php -l) 8 | - PHP_CodeSniffer 1.3+ (potentially works with lower versions, but this hasn’t been tested) 9 | - PHPMD 1.4+ (potentially works with lower versions, but this hasn’t been tested) 10 | - PHP CS Fixer version 0.2+ (potentially works with lower versions, but this hasn’t been tested) 11 | - Scheck 0.23+ 12 | - PHP Code Beautifier 2.2.0+ 13 | 14 | -------------------------------------------------------------------------------- /command_importer.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | path = os.path.dirname(os.path.realpath(__file__)) 4 | sys.path.append(path) 5 | 6 | from .lib import collector 7 | 8 | coll = collector.Collector(os.path.dirname(os.path.realpath(__file__))) 9 | 10 | for command in coll.get_commands(): 11 | try: 12 | cmd = __import__(command, globals(), locals(), ['*']) 13 | for attr in dir(cmd): 14 | if not attr.startswith('_'): 15 | globals()[attr] = getattr(cmd, attr) 16 | 17 | except ImportError: 18 | print("[sublimious] no module '%s'. Skipping... " % command) 19 | pass 20 | -------------------------------------------------------------------------------- /lib/package_resolver.py: -------------------------------------------------------------------------------- 1 | import threading 2 | 3 | 4 | class PackageResolver(threading.Thread): 5 | def __init__(self, package_control, packages, to_remove, callback): 6 | self.package_control = package_control 7 | self.packages = packages 8 | self.to_remove = to_remove 9 | self.callback = callback 10 | threading.Thread.__init__(self) 11 | 12 | def run(self): 13 | for pkg in self.to_remove: 14 | self.package_control.remove_package(pkg) 15 | 16 | for pkg in self.packages: 17 | self.package_control.install_package(pkg) 18 | 19 | self.callback() 20 | -------------------------------------------------------------------------------- /messages/install.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | _ _ _ _ 4 | ___ _ _| |__ | (_)_ __ ___ (_) ___ _ _ ___ 5 | / __| | | | '_ \| | | '_ ` _ \| |/ _ \| | | / __| 6 | \__ \ |_| | |_) | | | | | | | | | (_) | |_| \__ \ 7 | |___/\__,_|_.__/|_|_|_| |_| |_|_|\___/ \__,_|___/ 8 | - sublimetext reloaded 9 | 10 | Thanks for installing! 11 | Make sure to read the readme at https://github.com/dvcrn/sublimious/blob/master/README.md 12 | 13 | sublimious might need a bit on first startup, so just be a bit patient :) 14 | If you see errors, close them and restart sublimetext. Make sure to report at https://github.com/dvcrn/sublimious/issues 15 | 16 | Cheers! 17 | David 18 | -------------------------------------------------------------------------------- /layers/javascript/README.md: -------------------------------------------------------------------------------- 1 | # Javascript Layer 2 | 3 | Layer for adding javascript support and a bunch of linting. 4 | 5 | ## Requirements 6 | 7 | - `tern` 8 | - `flow` 9 | - `jshint` 10 | - `eslint` 11 | - `jsbeautify` 12 | 13 | ## Configuration 14 | 15 | The javascript layer comes with es6 and es5 mode. To use es6, set `use_es6` inside `.sublimious` to `True`. 16 | If tern is not available global under `/usr/loca/bin/tern`, change the tern path by adding the following to your package_settings: 17 | 18 | ``` 19 | "Tern": { 20 | "tern_command": ["node", "/usr/local/bin/tern"], 21 | } 22 | ``` 23 | 24 | ## Usage 25 | 26 | ### General 27 | 28 | `jshint`, `eslint` and friends will read your project specific `.eslintrc`, `jshintrc` and so on. If none is set, the normal default is being used. 29 | -------------------------------------------------------------------------------- /layers/javascript/layer.py: -------------------------------------------------------------------------------- 1 | class Layer(): 2 | name = "Javascript" 3 | 4 | required_packages = [ 5 | "Babel", 6 | "JsFormat", 7 | "tern_for_sublime", 8 | "SublimeLinter-flow", 9 | "SublimeLinter-jshint", 10 | "SublimeLinter-contrib-eslint", 11 | "SublimeLinter-json" 12 | ] 13 | 14 | sublimious_keymap = [] 15 | sublime_keymap = [] 16 | 17 | syntax_definitions = { 18 | "Javascript": ['js'], 19 | "JSON": ['.jshintrc', '.eslintrc', '.jsbeautifyrc'] 20 | } 21 | 22 | def init(self, config): 23 | if "use_es6" in config: 24 | if config["use_es6"] == True: 25 | self.syntax_definitions["JavaScript (Babel)"] = ["js", "jsx"] 26 | if "Javascript" in self.syntax_definitions: 27 | del self.syntax_definitions["Javascript"] 28 | -------------------------------------------------------------------------------- /layers/git/README.md: -------------------------------------------------------------------------------- 1 | # Git Layer 2 | 3 | ![git](http://i.imgur.com/udkcPfB.gif) 4 | 5 | This layer adds basic git support and is powered by [GitSavvy](https://github.com/divmain/GitSavvy/). 6 | 7 | ## Requirements 8 | 9 | - Git on your system 10 | 11 | ## Configuration 12 | 13 | None yet. Check out [GitSavvy](https://github.com/divmain/GitSavvy/blob/master/GitSavvy.sublime-settings) for things you can change. 14 | 15 | To use github integration, add the following under your `package_settings` inside `.sublimious`: 16 | 17 | ``` 18 | "GitSavvy": { 19 | "api_tokens": { 20 | "github.com": "API TOKEN HERE" 21 | } 22 | } 23 | ``` 24 | 25 | ## Usage 26 | 27 | ### General 28 | 29 | - ` g s`: Git status 30 | - ` g P`: Git push 31 | - ` g p`: Git pull 32 | - ` g c`: Git checkout 33 | - ` g n`: Git new branch 34 | - ` g f`: Git fetch 35 | - ` g l`: Git log 36 | - ` g a`: Git amend 37 | - ` g b`: Git blame 38 | 39 | ### Navigation 40 | 41 | - `q` will close the `status` buffer 42 | - navigation inside the `status` buffer is available with `j/k` 43 | -------------------------------------------------------------------------------- /layers/core/settings.py: -------------------------------------------------------------------------------- 1 | { 2 | "color_scheme": "Packages/Materialize/schemes/Material One Dark.tmTheme", 3 | "theme": "Material One Dark.sublime-theme", 4 | "material_theme_small_tab": True, 5 | "material_theme_accent_lime": True, 6 | 7 | "font_face": "Hack", 8 | "font_size": 14, 9 | 10 | "line_numbers": False, 11 | "show_minimap": False, 12 | "highlight_line": True, 13 | 14 | # Make caret sexier 15 | "caret_style": "phase", 16 | "caret_extra_top": 3, 17 | "caret_extra_bottom": 3, 18 | "caret_extra_width": 1, 19 | 20 | "scroll_past_end": True, 21 | "find_selected_text": True, 22 | "auto_find_in_selection": True, 23 | "drag_text": False, 24 | "inactive_panes_dim_strength": 0.1, 25 | 26 | "show_encoding": True, 27 | "draw_white_space": "selection", 28 | "word_wrap": True, 29 | "show_full_path": True, 30 | 31 | "translate_tabs_to_spaces": True, 32 | "ensure_newline_at_eof_on_save": True, 33 | "trim_trailing_white_space_on_save": True, 34 | 35 | "vintageous_use_sys_clipboard": True, 36 | "vintage_start_in_command_mode": True, 37 | 38 | "package_settings": { 39 | "AdvancedNewFile": { 40 | "rename_default": "./", 41 | "default_initial": "./" 42 | }, 43 | "SublimeLinter": { 44 | "styles": [ 45 | { 46 | "mark_style": "stippled_underline", 47 | } 48 | ] 49 | }, 50 | "Origami": { 51 | "create_new_pane_if_necessary": False 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /commands.py: -------------------------------------------------------------------------------- 1 | import sublime 2 | import sublime_plugin 3 | 4 | 5 | class ReloadSublimiousCommand(sublime_plugin.WindowCommand): 6 | def run(self, *args, **kw): 7 | print("Reloading sublimious....") 8 | 9 | from . import sublimious 10 | from . import spacelistener 11 | sublimious.plugin_loaded() 12 | spacelistener.plugin_loaded() 13 | 14 | 15 | class ShowSublimiousShortcutsCommand(sublime_plugin.TextCommand): 16 | def run(self, edit, arr): 17 | if len(arr) == 0: 18 | return 19 | 20 | self.view.set_read_only(False) 21 | self.view.erase(edit, sublime.Region(0, self.view.size())) 22 | s = [] 23 | for key, definition in sorted(arr.items()): 24 | s.append("%s ➜ %-20s" % ("[%s]" % key, definition)) 25 | 26 | for i, val in enumerate(s): 27 | if (i + 1) % 4 == 0: 28 | self.view.insert(edit, self.view.size(), "%s\n" % val) 29 | continue 30 | 31 | self.view.insert(edit, self.view.size(), val) 32 | 33 | self.view.settings().set("word_wrap", False) 34 | 35 | self.view.settings().set('color_scheme', 'Packages/sublimious/keyhelper/keyhelper.tmTheme') 36 | self.view.set_syntax_file("Packages/sublimious/keyhelper/keyhelper.sublime-syntax") 37 | self.view.set_read_only(True) 38 | self.view.show(self.view.size()) 39 | 40 | 41 | class StatusCommand(sublime_plugin.TextCommand): 42 | def run(self, edit, text): 43 | self.view.set_read_only(False) 44 | self.view.insert(edit, self.view.size(), "%s\n" % text) 45 | self.view.set_read_only(True) 46 | self.view.show(self.view.size()) 47 | -------------------------------------------------------------------------------- /lib/package_controller.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | 4 | from .package_resolver import PackageResolver 5 | 6 | import sublime 7 | 8 | 9 | class PackageController: 10 | user_dir = None 11 | 12 | def __init__(self): 13 | sublime_dir = os.path.dirname(sublime.packages_path()) 14 | installed_packages_dir = os.path.join(sublime_dir, 'Installed Packages') 15 | packages_dir = os.path.join(sublime_dir, 'Packages') 16 | 17 | self.user_dir = os.path.join(packages_dir, 'User') 18 | 19 | package_control = os.path.join(installed_packages_dir, "Package Control.sublime-package") 20 | sys.path.append(package_control) 21 | 22 | from package_control.package_manager import PackageManager 23 | self.package_control = PackageManager() 24 | 25 | def install_packages(self, packages, callback=lambda: True, wipe_others=True): 26 | if wipe_others: 27 | installed_packages = self.package_control.list_packages() 28 | 29 | to_remove = [] 30 | for pkg in installed_packages: 31 | if pkg not in packages: 32 | to_remove.append(pkg) 33 | 34 | to_install = [] 35 | for pkg in packages: 36 | if pkg in installed_packages: 37 | continue 38 | to_install.append(pkg) 39 | 40 | PackageResolver(self.package_control, to_install, to_remove, callback).start() 41 | 42 | def reload(self): 43 | # We have to delete `Package Control.last-run` to not run into the cache 44 | last_run_file = os.path.join(self.user_dir, "Package Control.last-run") 45 | if os.path.isfile(last_run_file): 46 | os.remove(last_run_file) 47 | 48 | from package_control.package_cleanup import PackageCleanup 49 | sublime.set_timeout(lambda: PackageCleanup().start(), 2000) 50 | -------------------------------------------------------------------------------- /layers/git/layer.py: -------------------------------------------------------------------------------- 1 | class Layer(): 2 | name = "Git" 3 | 4 | required_packages = [ 5 | "GitGutter", 6 | "GitSavvy", 7 | ] 8 | 9 | sublimious_keymap = [ 10 | # ----- Git 11 | {"keys": ["g"], "category": "git"}, 12 | {"keys": ["g", "s"], "command": "gs_show_status", "description": "status", "args": {}}, 13 | {"keys": ["g", "P"], "command": "gs_push", "description": "push", "args": {}}, 14 | {"keys": ["g", "p"], "command": "gs_pull", "description": "pull", "args": {}}, 15 | {"keys": ["g", "n"], "command": "gs_checkout_new_branch", "description": "new branch", "args": {}}, 16 | {"keys": ["g", "c"], "command": "gs_checkout_branch", "description": "checkout", "args": {}}, 17 | {"keys": ["g", "l"], "command": "gs_log", "description": "log", "args": {}}, 18 | {"keys": ["g", "f"], "command": "gs_fetch", "description": "fetch", "args": {}}, 19 | {"keys": ["g", "a"], "command": "gs_commit", "description": "amend", "args": {"amend": True}}, 20 | {"keys": ["g", "d"], "command": "gs_diff", "description": "diff", "args": {}}, 21 | ] 22 | 23 | sublime_keymap = [ 24 | {"keys": ["j"], "command": "gs_status_navigate_file", "args": {"forward": True}, "context": [{"key": "setting.git_savvy.status_view", "operator": "equal", "operand": True}]}, 25 | {"keys": ["k"], "command": "gs_status_navigate_file", "args": {"forward": False}, "context": [{"key": "setting.git_savvy.status_view", "operator": "equal", "operand": True}]}, 26 | {"keys": ["q"], "command": "close", "args": {}, "context": [{"key": "setting.git_savvy.status_view", "operator": "equal", "operand": True}]}, 27 | {"keys": ["q"], "command": "close", "args": {}, "context": [{"key": "setting.git_savvy.diff_view", "operator": "equal", "operand": True}]}, 28 | {"keys": ["q"], "command": "close", "args": {}, "context": [{"key": "setting.git_savvy.inline_diff_view", "operator": "equal", "operand": True}]}, 29 | ] 30 | 31 | syntax_definitions = {} 32 | 33 | def init(self, config): 34 | pass 35 | -------------------------------------------------------------------------------- /keyhelper/keyhelper.tmTheme: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | author 7 | David Mohl (dvcrn) 8 | name 9 | KeyHelper 10 | semanticClass 11 | theme.sublimious.keyhelper 12 | colorSpaceName 13 | sRGB 14 | settings 15 | 16 | 17 | settings 18 | 19 | background 20 | #272B33 21 | caret 22 | #528BFF 23 | foreground 24 | #A6B2C0 25 | invisibles 26 | #747369 27 | lineHighlight 28 | #2B313A 29 | selection 30 | #3D4350 31 | 32 | 33 | 34 | 35 | name 36 | Keybinding 37 | scope 38 | keybinding 39 | settings 40 | 41 | foreground 42 | #57B6C2 43 | 44 | 45 | 46 | 47 | name 48 | Description 49 | scope 50 | description 51 | settings 52 | 53 | foreground 54 | #E5C17C 55 | 56 | 57 | 58 | 59 | name 60 | Category 61 | scope 62 | category 63 | settings 64 | 65 | foreground 66 | #D2945D 67 | 68 | 69 | 70 | 71 | uuid 72 | 32bd64fa-d60a-4858-a5fc-5164cc49a2b8 73 | comment 74 | Work in progress 75 | 76 | 77 | -------------------------------------------------------------------------------- /templates/.sublimious: -------------------------------------------------------------------------------- 1 | # This file is read by sublimious. Feel free to put your stuff here. 2 | 3 | """ 4 | Change the following line to True to activate sublimious 5 | By changing it to true, you are aware that this will wipe your configuration. 6 | Please make sure that you have a backup in place! (eg backup User/) 7 | 8 | I mean, seriously. This will delete ALL your sublime setting files 9 | """ 10 | nuke_everything = False 11 | 12 | # Layer configuration. These layers will get installed upon reload 13 | # Check sublimious/layers for all available layers 14 | layers = [ 15 | 'core', 16 | 17 | # 'osx', 18 | # 'git', 19 | # 'python', 20 | # 'javascript', 21 | # 'markdown', 22 | # 'coffee', 23 | # 'php', 24 | # 'elixir', 25 | # 'clojure' 26 | ] 27 | 28 | """ 29 | Everything that is not part of a layer. 30 | These packages will be installed through package control 31 | """ 32 | additional_packages = [ 33 | 34 | ] 35 | 36 | """ 37 | Put your own config in here or override defaults 38 | """ 39 | user_config = { 40 | # Sublimious general 41 | # How long should sublimious wait before showing you the overlay? 42 | # "shortcut_overlay_timeout": 1 43 | # "show_shortcut_overlay": True 44 | 45 | # Style! 46 | # Uncomment the following lines to overwrite the basic appearance and color 47 | # "color_scheme": "Packages/Materialize/schemes/Material One Dark.tmTheme", 48 | # "theme": "Material Brogrammer.sublime-theme", 49 | # "font_face": "Hack", 50 | # "font_size": 18, 51 | 52 | # These lines are responsible for editor appearance 53 | # "line_numbers": False, 54 | # "draw_white_space": "selection", 55 | # "word_wrap": True, 56 | 57 | # How should sublime text deal with spaces and encodings? 58 | # "translate_tabs_to_spaces": True, 59 | # "ensure_newline_at_eof_on_save": True, 60 | # "trim_trailing_white_space_on_save": True, 61 | 62 | # Sublimious comes pre-configured with a lot of good settings 63 | # But if you are not happy with them, overwrite them here 64 | # Take the package name from the -> menu 65 | "package_settings": { 66 | # "SomePackages": { 67 | # "some_config": "something else", 68 | # } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution guidelines 2 | 3 | Thank you for your interest in contributing to this project! You rock! 4 | 5 | Here are some smaller things to look out for when adding code to this repository 6 | 7 | ## Style guide 8 | 9 | While not 100% there yet, make sure your code is pep8 / flake8 compliant. If you use sublimious to develop sublimious, you should automatically have the linters set up correctly to warn you about this. 10 | 11 | ## Commit format 12 | 13 | Please use the following format to submit commits 14 | ``` 15 | feat(ngInclude): add template url parameter to events 16 | 17 | The `src` (i.e. the url of the template to load) is now provided to the 18 | `$includeContentRequested`, `$includeContentLoaded` and `$includeContentError` 19 | events. 20 | 21 | Closes #8453 22 | Closes #8454 23 | ``` 24 | 25 | ``` 26 | component commit title 27 | commit type / / 28 | \ | | 29 | feat(ngInclude): add template url parameter to events 30 | 31 | body -> The 'src` (i.e. the url of the template to load) is now provided to the 32 | `$includeContentRequested`, `$includeContentLoaded` and `$includeContentError` 33 | events. 34 | 35 | referenced -> Closes #8453 36 | issues Closes #8454 37 | ``` 38 | 39 | For the commit type, use the matching type from this list: 40 | - **feat**: A new feature 41 | - **fix**: A bug fix 42 | - **docs**: Documentation only changes 43 | - **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing 44 | semi-colons, etc) 45 | - **refactor**: A code change that neither fixes a bug nor adds a feature 46 | - **perf**: A code change that improves performance 47 | - **test**: Adding missing tests 48 | - **chore**: Changes to the build process or auxiliary tools and libraries such as documentation 49 | generation 50 | 51 | ### Summary 52 | 53 | Please use __present tense__ inside your commit message at all time. Keywords like `add` `fix` and friends should be in __lower case__ to keep things consistent. 54 | 55 | ### Linking to github 56 | 57 | Here as well, please make sure that you use the __present tense__ for `Closes` and `Fixes` and add `References #XX` before referencing a github issue if you are not closing it. Please write these keywords in __uppercase__. 58 | 59 | ## Pull requests 60 | Pull requests are currently submitted to `master`. This might change in the future so please keep an eye on this. 61 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rock your SublimeText with VIM keybindings and Sublimious! 2 | 3 | [![Join the chat at https://gitter.im/dvcrn/sublimious](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dvcrn/sublimious?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 4 | 5 | ``` 6 | Sublimious is SublimeText 3 configuration system inspired by spacemacs and based around VIM. 7 | ``` 8 | 9 | __NOTE:__ Due to the SublimeText's uncertain future and slow development this project has been frozen and development shifted to atom with [proton](https://github.com/dvcrn/proton). If ST3's development picks up and long needed features are getting implemented, I will continue this project. Until then, PRs are welcome! 10 | 11 | ![Shortcuts](http://i.imgur.com/uvDjXNf.png) 12 | 13 | ### Install 14 | Install `sublimious` through [package control](https://packagecontrol.io/packages/sublimious). 15 | 16 | Currently sublimious is using the [Hack font face](https://github.com/chrissimpkins/Hack). If you don't have it installed, change `font_face` inside your `.sublimious` or download it here - https://github.com/chrissimpkins/Hack/releases. I can highly recommend you to install it though! 17 | 18 | Alternatively, clone this repository into your `Packages/` directory if you prefer this method (good if you want to contribute :)!) 19 | 20 | __Be warned__! Sublimious is a complete configuration system and will nuke your existing configuration. Make sure to backup your configs before trying sublimious! 21 | 22 | ### Features 23 | 24 | Control everything with easy to remember shortcuts! 25 | 26 | ![showcase](http://i.imgur.com/MqsB6Pt.gif) 27 | 28 | - __Preconfigured__: sublimious instantly makes sublime text better by shipping with a handful of hand-tested settings 29 | - __VIM everywhere!__: All packages included with sublimious have been remapped to fit with vim keybindings 30 | - __Easy to remember mnemonic__: Each command is mapped to a category / key combination that fits the action. ` w v` for example splits the [__w__]indow [__v__]ertically. 31 | - __Layer based configuration__: Check `layers/` for all configuration sets shipping with sublimious. Just add it to your `~/.sublimious` config and they will be included upon restart 32 | - __Easy to use with dotfiles__: Just take your `~/.sublimious` config to your new pc and it will act exactly the same way as it did on your other pc 33 | - __Central configuration__: Instead of maintaining 10 files, you only have 1 to put your settings in 34 | 35 | ### Keybindings 36 | 37 | Sublimious comes with a keybinding helper to ease you in with everything. Just hit `space` and a popup will tell you what you can perform. 38 | 39 | ![keybindings](http://i.imgur.com/NBbFOCm.gif) 40 | 41 | In general, sublimious follows the spacemacs mnemonic: 42 | - ` p` is for project commands 43 | - ` b` is for actions on the current buffer 44 | - ` g` is for git (needs git layer) 45 | - ` w` for window (splits and co) 46 | - ` s` for the current (visual) selection 47 | - ` e` for errors (linting) 48 | - ` t` is for toggles (sidebar, statusbar) 49 | - ` _` is for meta commands (sublimious reload) 50 | 51 | Sublimious tries to add vim-like keybindings for every plugin possible. Sidebar navigation for example has been remapped to `j/k`. 52 | 53 | ### Tips and Tricks 54 | 55 | - after changing your .sublimious file, hit ` _ r` to re-feed your .sublimious config into sublimetext. All changes will be reloaded immediately. This includes packages, settings and layers. 56 | 57 | 58 | ### Contributing 59 | 60 | There are a lot of things to do. Please check out the [issue tracker](https://github.com/dvcrn/sublimious/issues) and feel free to submit a pull request. 61 | 62 | For contributing guidelines, make sure you read the [CONTRIBUTING.md](https://github.com/dvcrn/sublimious/blob/master/.github/CONTRIBUTING.md) document. 63 | 64 | ### License 65 | 66 | GPLv3 67 | -------------------------------------------------------------------------------- /sublimious.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | path = os.path.dirname(os.path.realpath(__file__)) 4 | sys.path.append(path) 5 | 6 | import sublime # noqa 7 | import json # noqa 8 | 9 | from .lib.collector import Collector # noqa 10 | from .lib.io import write_sublimious_file # noqa 11 | from .lib.package_controller import PackageController # noqa 12 | 13 | 14 | class Sublimious(): 15 | 16 | def __init__(self): 17 | self.sublime_dir = os.path.dirname(sublime.packages_path()) 18 | self.packages_dir = os.path.join(self.sublime_dir, 'Packages') 19 | self.sublimious_packages_dir = os.path.join(self.packages_dir, 'sublimious/') 20 | self.user_dir = os.path.join(self.packages_dir, 'User') 21 | self.current_path = os.path.dirname(os.path.realpath(__file__)) 22 | self.collector = Collector(self.current_path) 23 | self.status_panel = sublime.active_window().create_output_panel("sublimious_status_panel") 24 | 25 | sublime.active_window().run_command("show_panel", {"panel": "output.sublimious_status_panel", "toggle": False}) 26 | 27 | package_controller = PackageController() 28 | 29 | if not self.collector.get_user_config().nuke_everything: 30 | self.status_panel.run_command("status", {"text": "Sublimious is currently off."}) 31 | self.status_panel.run_command("status", {"text": "Since this might be your first start, I created a ~/.sublimious file"}) 32 | self.status_panel.run_command("status", {"text": "Open that file and change 'nuke_everything' to True to proceed\n"}) 33 | sys.exit() 34 | 35 | self.status_panel.run_command("status", {"text": "Welcome to Sublimious. Just a moment, I'm initializing some things..."}) 36 | 37 | # Nuke everything 38 | if not os.path.isdir(self.sublimious_packages_dir): 39 | os.mkdir(self.sublimious_packages_dir) 40 | 41 | settings_current = [os.path.join(self.sublimious_packages_dir, f) for f in os.listdir(self.sublimious_packages_dir) if f.endswith(".sublime-settings")] 42 | settings_user = [os.path.join(self.user_dir, f) for f in os.listdir(self.user_dir) if f.endswith(".sublime-settings")] 43 | filelist = settings_current + settings_user 44 | 45 | # Delete all settings except Package Control 46 | for f in filelist: 47 | if "Package Control" in f or "Preferences" in f: 48 | continue 49 | 50 | os.remove(f) 51 | 52 | # Second iteration to initialise all layers with config 53 | collected_config = self.collector.get_collected_config() 54 | for layer in self.collector.get_layers(): 55 | layer.init(collected_config) 56 | 57 | # Collect all packages 58 | all_packages = self.collector.collect_key("required_packages") + self.collector.get_user_config().additional_packages 59 | package_controller.install_packages(all_packages, callback=self.after_install) 60 | 61 | def after_install(self): 62 | settings_file = os.path.join(self.user_dir, 'Preferences.sublime-settings') 63 | 64 | # Get all keybinding definitions and save to keymapfile 65 | write_sublimious_file("%s/Default.sublime-keymap" % self.user_dir, json.dumps(self.collector.collect_key("sublime_keymap"))) 66 | 67 | # Generate a bunch of syntax files depending on layer config 68 | syntax_definitions = self.collector.collect_syntax_specific_settings() 69 | for syntax, value in syntax_definitions.items(): 70 | write_sublimious_file("%s/%s.sublime-settings" % (self.sublimious_packages_dir, syntax), json.dumps(value)) 71 | 72 | # Generate package specific settings 73 | for package, setting in self.collector.get_collected_config()["package_settings"].items(): 74 | write_sublimious_file("%s/%s.sublime-settings" % (self.user_dir, package), json.dumps(setting)) 75 | 76 | # Take control over sublime settings file 77 | write_sublimious_file(settings_file, json.dumps(self.collector.get_collected_config())) 78 | 79 | self.status_panel.run_command("status", {"text": "All done! Enjoy sublimious."}) 80 | print("[sublimious] finishing setup.") 81 | 82 | 83 | def plugin_loaded(): 84 | Sublimious() 85 | -------------------------------------------------------------------------------- /lib/collector.py: -------------------------------------------------------------------------------- 1 | import itertools 2 | import os 3 | import shutil 4 | 5 | from .io import load_python_file 6 | from .helpers import mergedicts 7 | 8 | import zipfile 9 | 10 | 11 | class Collector(): 12 | layers = [] 13 | collected_config = {} 14 | user_config = {} 15 | is_zip = False 16 | zip_file = None 17 | 18 | def __init__(self, sublimious_dir, user_dir=None): 19 | self.layers = [] 20 | self.commands = [] 21 | self.collected_config = {} 22 | self.user_config = {} 23 | self.is_zip = False 24 | self.zip_file = None 25 | 26 | if "sublime-package" in sublimious_dir: 27 | self.is_zip = True 28 | self.zip_file = zipfile.ZipFile(sublimious_dir) 29 | 30 | config_path = os.path.expanduser("~/.sublimious") 31 | if not os.path.exists(config_path): 32 | if self.is_zip: 33 | templ = self.zip_file.open("templates/.sublimious") 34 | target = open(config_path, "wb") 35 | shutil.copyfileobj(templ, target) 36 | target.close() 37 | else: 38 | template_path = "%s/%s" % (sublimious_dir, "templates/.sublimious") 39 | shutil.copyfile(template_path, config_path) 40 | 41 | print("[sublimious] no config found. Copied template.") 42 | 43 | config_file = load_python_file(config_path) 44 | 45 | # Collect all layers and layer configurations 46 | for layer in config_file.layers: 47 | 48 | try: 49 | if self.is_zip: 50 | layer_init = __import__("layers.%s.layer" % layer, globals(), locals(), ['Layer']) 51 | else: 52 | layer_init_file = "%s/%s/layer.py" % (sublimious_dir, "layers/%s" % layer) 53 | layer_init = load_python_file(layer_init_file) 54 | except ImportError: 55 | print("[sublimious] tried to load layer '%s' but couldn't import it. Does it exist?" % layer) 56 | continue 57 | 58 | self.layers.append(layer_init.Layer()) 59 | self.commands.append("layers.%s.commands" % layer) 60 | 61 | if self.is_zip: 62 | settings = eval(self.zip_file.read("layers/%s/settings.py" % layer)) 63 | else: 64 | layer_settings_file = "%s/%s/settings.py" % (sublimious_dir, "layers/%s" % layer) 65 | settings = eval(open(layer_settings_file, 'r').read()) 66 | 67 | self.collected_config = mergedicts(self.collected_config, settings) 68 | 69 | # Load user configuration on top 70 | if (len(config_file.user_config) > 0): 71 | self.collected_config = mergedicts(self.collected_config, config_file.user_config) 72 | 73 | self.user_config = config_file 74 | 75 | def get_layers(self): 76 | return self.layers 77 | 78 | def get_commands(self): 79 | return self.commands 80 | 81 | def get_collected_config(self): 82 | return self.collected_config 83 | 84 | def get_user_config(self): 85 | return self.user_config 86 | 87 | def collect_syntax_specific_settings(self): 88 | syntax_definitions = {} 89 | 90 | for layer in self.layers: 91 | if not hasattr(layer, "syntax_definitions"): 92 | continue 93 | 94 | for syntax, files in layer.syntax_definitions.items(): 95 | if syntax not in syntax_definitions: 96 | syntax_definitions[syntax] = {"extensions": []} 97 | 98 | syntax_definitions[syntax]["extensions"] = list(set(syntax_definitions[syntax]["extensions"] + files)) 99 | 100 | if not hasattr(layer, "color_scheme_definitions"): 101 | continue 102 | 103 | for syntax, color_schemes in layer.color_scheme_definitions.items(): 104 | if syntax not in syntax_definitions: 105 | syntax_definitions[syntax] = {"color_scheme": []} 106 | 107 | if "color_scheme" not in syntax_definitions[syntax]: 108 | syntax_definitions[syntax]["color_scheme"] = color_schemes 109 | 110 | return syntax_definitions 111 | 112 | def collect_key(self, key): 113 | collected_list = list(map(lambda i: getattr(i, key), self.layers)) 114 | return list(itertools.chain(*collected_list)) 115 | -------------------------------------------------------------------------------- /spacelistener.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | path = os.path.dirname(os.path.realpath(__file__)) 4 | sys.path.append(path) 5 | 6 | import sublime_plugin 7 | import sublime 8 | import threading 9 | 10 | from .lib import helpers 11 | from .lib import collector 12 | 13 | keys = { 14 | "SPACE": "", 15 | "ESCAPE": "" 16 | } 17 | 18 | 19 | class SpaceListener(sublime_plugin.EventListener): 20 | settings = { 21 | 'shortcut_overlay_timeout': 0.2, 22 | 'show_shortcut_overlay': True 23 | } 24 | 25 | command_chain = [] 26 | last_key = None 27 | inChain = False 28 | shortcut_panel = None 29 | help_timeout = None 30 | collector = None 31 | cached_action_tree = None 32 | 33 | def generate_action_tree(self): 34 | if self.cached_action_tree: 35 | return self.cached_action_tree 36 | 37 | keymap = self.collector.collect_key("sublimious_keymap") 38 | 39 | action_tree = {} 40 | for command in keymap: 41 | keys = command.get("keys") 42 | action = command.get("command", None) 43 | category = command.get("category", None) 44 | description = command.get("description", None) 45 | args = command.get("args", {}) 46 | 47 | leaf = {} 48 | first = True 49 | for key in reversed(keys): 50 | if first: 51 | first = False 52 | if action: 53 | leaf[key] = {"action": action, "args": args, "description": description} 54 | 55 | if category: 56 | leaf[key] = {"category": category} 57 | 58 | continue 59 | 60 | leaf = { 61 | key: leaf 62 | } 63 | 64 | action_tree = helpers.mergedicts(action_tree, leaf) 65 | 66 | self.cached_action_tree = action_tree 67 | return action_tree 68 | 69 | def flatten_action_set(self, actionset): 70 | out = {} 71 | for key, action in actionset.items(): 72 | if "category" in action: 73 | out[key] = "+%s" % action["category"] 74 | 75 | if "action" in action: 76 | text = action["action"] 77 | if "description" in action: 78 | text = action["description"] 79 | 80 | out[key] = "%s" % text 81 | 82 | return out 83 | 84 | def get_actions_for_keyset(self, keyset=None): 85 | action_tree = self.generate_action_tree() 86 | if keyset is None or len(keyset) == 0: 87 | return self.flatten_action_set(action_tree) 88 | 89 | try: 90 | tree = action_tree 91 | for key in keyset: 92 | if "category" in tree[key]: 93 | tree = tree[key] 94 | except KeyError: 95 | return None 96 | 97 | return self.flatten_action_set(tree) 98 | 99 | def show_help(self): 100 | actions = self.get_actions_for_keyset(self.command_chain) 101 | if actions is None: 102 | self.end_command_chain() 103 | return 104 | 105 | self.shortcut_panel.run_command("show_sublimious_shortcuts", {"arr": actions}) 106 | sublime.active_window().run_command("show_panel", {"panel": "output.sublimious_shortcut_panel", "toggle": False}) 107 | 108 | def hide_help(self): 109 | sublime.active_window().run_command("hide_panel", {"panel": "output.sublimious_shortcut_panel", "toggle": False}) 110 | 111 | def delegate_help_panel(self): 112 | if not self.settings["show_shortcut_overlay"]: 113 | return 114 | 115 | if self.help_timeout: 116 | self.help_timeout.cancel() 117 | 118 | if self.settings["shortcut_overlay_timeout"] == 0: 119 | self.show_help() 120 | return 121 | 122 | self.help_timeout = threading.Timer(self.settings["shortcut_overlay_timeout"], self.show_help) 123 | self.help_timeout.start() 124 | 125 | def start_command_chain(self): 126 | self.command_chain = [] 127 | self.inChain = True 128 | self.delegate_help_panel() 129 | 130 | def end_command_chain(self): 131 | if self.help_timeout: 132 | self.help_timeout.cancel() 133 | 134 | self.inChain = False 135 | 136 | def add_command(self, key): 137 | if self.inChain: 138 | self.hide_help() 139 | self.command_chain.append(key) 140 | 141 | def try_resolve_chain(self): 142 | if self.inChain: 143 | if self.command_chain[-2:] == ['f', 'd'] \ 144 | or self.command_chain[-1] == keys["ESCAPE"] \ 145 | or self.command_chain[-1] == 'q': 146 | self.end_command_chain() 147 | return True 148 | 149 | tree = self.generate_action_tree() 150 | for key in self.command_chain: 151 | if key not in tree: 152 | return False 153 | 154 | tree = tree[key] 155 | 156 | # check if we are on the final node 157 | if "action" in tree: 158 | sublime.active_window().run_command(tree["action"], tree["args"]) 159 | self.end_command_chain() 160 | return True 161 | 162 | return False 163 | 164 | def on_window_command(self, window, command_name, args): 165 | if command_name == "press_key" and args["key"]: 166 | print(args["key"]) 167 | if args["key"] == keys["SPACE"] and not self.inChain: 168 | self.start_command_chain() 169 | return ("noop") 170 | 171 | if self.inChain: 172 | self.add_command(args["key"]) 173 | if not self.try_resolve_chain(): 174 | self.delegate_help_panel() 175 | 176 | return ("noop") 177 | 178 | self.last_key = args["key"] 179 | self.hide_help() 180 | 181 | def on_query_context(self, view, key, *args, **kwargs): 182 | # If we are in a command chain, we deny certain keybindings 183 | if key == 'sublimious_chain': 184 | return (not self.inChain) 185 | 186 | 187 | def plugin_loaded(): 188 | coll = collector.Collector(os.path.dirname(os.path.realpath(__file__))) 189 | SpaceListener.shortcut_panel = sublime.active_window().create_output_panel("sublimious_shortcut_panel") 190 | SpaceListener.collector = coll 191 | SpaceListener.settings = helpers.mergedicts(SpaceListener.settings, coll.get_collected_config()) 192 | -------------------------------------------------------------------------------- /layers/core/layer.py: -------------------------------------------------------------------------------- 1 | class Layer(): 2 | name = "Core" 3 | 4 | required_packages = [ 5 | "sublimious", 6 | "Package Control", 7 | "Vintage-Origami", 8 | "DocBlockr", 9 | "Vintageous", 10 | "VintageousPluginSurround", 11 | "Origami", 12 | "SublimeLinter", 13 | "Surround", 14 | "BracketHighlighter", 15 | "AdvancedNewFile", 16 | "InactivePanes", 17 | "Theme - Soda SolarizedDark", 18 | "ExtendedTabSwitcher", 19 | "TabsShortcuts", 20 | "Materialize", 21 | "AceJump" 22 | ] 23 | 24 | sublimious_keymap = [ 25 | # ----- Window commands 26 | # All these commands here will only work in command mode 27 | 28 | # Powered by Origami 29 | {"keys": ["w"], "category": "window"}, 30 | {"keys": ["w", "v"], "command": "create_pane", "description": "split vertically", "args": {"direction": "right", "give_focus": True}}, 31 | {"keys": ["w", "/"], "command": "create_pane", "description": "split vertically", "args": {"direction": "right", "give_focus": True}}, 32 | {"keys": ["w", "s"], "command": "create_pane", "description": "split horizontally", "args": {"direction": "down", "give_focus": True}}, 33 | {"keys": ["w", "-"], "command": "create_pane", "description": "split horizontally", "args": {"direction": "down", "give_focus": True}}, 34 | {"keys": ["w", "c"], "command": "destroy_pane", "description": "close window", "args": {"direction": "self"}}, 35 | {"keys": ["w", "m"], "command": "set_layout", "description": "maximise window", "args": {"cells": [[0, 0, 1, 1]], "cols": [0.0, 1.0], "rows": [0.0, 1.0]}}, 36 | 37 | # Panel navigation 38 | {"keys": ["w", "0"], "command": "focus_side_bar", "description": "focus side bar"}, 39 | {"keys": ["w", "1"], "command": "focus_group", "description": "focus window 1", "args": {"group": 0}}, 40 | {"keys": ["w", "2"], "command": "focus_group", "description": "focus window 2", "args": {"group": 1}}, 41 | {"keys": ["w", "3"], "command": "focus_group", "description": "focus window 3", "args": {"group": 2}}, 42 | {"keys": ["w", "4"], "command": "focus_group", "description": "focus window 4", "args": {"group": 3}}, 43 | {"keys": ["w", "5"], "command": "focus_group", "description": "focus window 5", "args": {"group": 4}}, 44 | {"keys": ["w", "6"], "command": "focus_group", "description": "focus window 6", "args": {"group": 5}}, 45 | {"keys": ["w", "7"], "command": "focus_group", "description": "focus window 7", "args": {"group": 6}}, 46 | {"keys": ["w", "8"], "command": "focus_group", "description": "focus window 8", "args": {"group": 7}}, 47 | {"keys": ["w", "9"], "command": "focus_group", "description": "focus window 9", "args": {"group": 8}}, 48 | 49 | {"keys": ["w", "l"], "command": "travel_to_pane", "description": "focus right pane", "args": {"direction": "right"}}, 50 | {"keys": ["w", "h"], "command": "travel_to_pane", "description": "focus left pane", "args": {"direction": "left"}}, 51 | {"keys": ["w", "j"], "command": "travel_to_pane", "description": "focus down pane", "args": {"direction": "down"}}, 52 | {"keys": ["w", "k"], "command": "travel_to_pane", "description": "focus up pane", "args": {"direction": "up"}}, 53 | 54 | {"keys": ["0"], "command": "focus_side_bar", "description": "focus side bar"}, 55 | {"keys": ["1"], "command": "focus_group", "description": "focus window 1", "args": {"group": 0}}, 56 | {"keys": ["2"], "command": "focus_group", "description": "focus window 2", "args": {"group": 1}}, 57 | {"keys": ["3"], "command": "focus_group", "description": "focus window 3", "args": {"group": 2}}, 58 | {"keys": ["4"], "command": "focus_group", "description": "focus window 4", "args": {"group": 3}}, 59 | {"keys": ["5"], "command": "focus_group", "description": "focus window 5", "args": {"group": 4}}, 60 | {"keys": ["6"], "command": "focus_group", "description": "focus window 6", "args": {"group": 5}}, 61 | {"keys": ["7"], "command": "focus_group", "description": "focus window 7", "args": {"group": 6}}, 62 | {"keys": ["8"], "command": "focus_group", "description": "focus window 8", "args": {"group": 7}}, 63 | {"keys": ["9"], "command": "focus_group", "description": "focus window 9", "args": {"group": 8}}, 64 | 65 | # Panel resize 66 | {"keys": ["r"], "category": "resize"}, 67 | {"keys": ["r", "c"], "command": "resize_pane", "description": "column ", "args": {"orientation": "cols"}}, 68 | {"keys": ["r", "r"], "command": "resize_pane", "description": "row ", "args": {"orientation": "rows"}}, 69 | 70 | 71 | # ----- Project commands 72 | {"keys": ["p"], "category": "project"}, 73 | {"keys": ["p", "t"], "command": "toggle_side_bar", "description": "toggle sidebar"}, 74 | {"keys": ["p", "f"], "command": "show_overlay", "description": "find file", "args": {"overlay": "goto", "show_files": True}}, 75 | {"keys": ["p", "c"], "command": "advanced_new_file_new", "description": "create file"}, 76 | {"keys": ["p", "R"], "command": "reveal_in_side_bar", "description": "reveal file"}, 77 | {"keys": ["p", "s"], "command": "show_panel", "args": {"panel": "find_in_files"}, "description": "search file"}, 78 | {"keys": ["/"], "command": "show_panel", "args": {"panel": "find_in_files"}, "description": "smart search"}, 79 | {"keys": ["p", "p"], "command": "prompt_select_workspace", "args": {}, "description": "switch project"}, 80 | 81 | # ----- Buffers 82 | {"keys": [""], "command": "next_view_in_stack", "description": "previous buffer"}, 83 | 84 | # ----- Errors 85 | {"keys": ["e"], "category": "errors"}, 86 | {"keys": ["e", "l"], "command": "sublimelinter_show_all_errors", "description": "list lint errors"}, 87 | {"keys": ["e", "n"], "command": "sublimelinter_goto_error", "description": "next lint error", "args": {"direction": "next"}}, 88 | {"keys": ["e", "p"], "command": "sublimelinter_show_all_errors", "description": "prev lint error", "args": {"direction": "previous"}}, 89 | 90 | # ----- Selection 91 | {"keys": ["s"], "category": "selection"}, 92 | {"keys": ["s", "e"], "command": "find_all_under", "description": "expand selection"}, 93 | {"keys": ["s", "l"], "command": "split_selection_into_lines", "description": "add cursor to lines"}, 94 | 95 | 96 | # ----- Buffer 97 | {"keys": ["b"], "category": "buffer"}, 98 | {"keys": ["b", "m"], "command": "advanced_new_file_move", "description": "move/rename file"}, 99 | {"keys": ["b", "b"], "command": "extended_switcher", "args": {"list_mode": "window"}, "description": "navigate buffers"}, 100 | {"keys": ["b", "c"], "command": "close", "description": "close buffer"}, 101 | {"keys": ["b", "C"], "command": "close_others", "description": "close other buffers"}, 102 | {"keys": ["b", "K"], "command": "close_others", "description": "kill other buffers"}, 103 | 104 | {"keys": ["b", "p"], "category": "push to"}, 105 | {"keys": ["b", "p", "l"], "command": "carry_file_to_pane", "args": {"direction": "right"}, "description": "right"}, 106 | {"keys": ["b", "p", "h"], "command": "carry_file_to_pane", "args": {"direction": "left"}, "description": "left"}, 107 | {"keys": ["b", "p", "j"], "command": "carry_file_to_pane", "args": {"direction": "down"}, "description": "down"}, 108 | {"keys": ["b", "p", "k"], "command": "carry_file_to_pane", "args": {"direction": "up"}, "description": "up"}, 109 | 110 | # ----- Toggles 111 | {"keys": ["t"], "category": "toggles"}, 112 | {"keys": ["t", "s"], "command": "toggle_status_bar", "description": "toggle statusbar"}, 113 | {"keys": ["t", "t"], "command": "toggle_side_bar", "description": "toggle sidebar"}, 114 | {"keys": ["t", "l"], "command": "toggle_setting", "args": {"setting": "line_numbers"}, "description": "toggle line numbers"}, 115 | {"keys": ["t", "m"], "command": "toggle_minimap", "args": {}, "description": "toggle minimap"}, 116 | {"keys": ["t", "M"], "command": "toggle_menu", "args": {}, "description": "toggle menu"}, 117 | {"keys": ["t", "T"], "command": "toggle_tabs", "args": {}, "description": "toggle tabs"}, 118 | 119 | # ----- Meta 120 | {"keys": ["_"], "category": "meta"}, 121 | {"keys": ["_", "r"], "command": "reload_sublimious", "description": "reload .sublimious"}, 122 | {"keys": ["_", "e"], "command": "open_sublimious_config", "description": "edit .sublimious"}, 123 | 124 | # ----- ace jump 125 | {"keys": ["j"], "category": "jump"}, 126 | {"keys": ["j", "j"], "command": "ace_jump_char", "description": "jump to char"}, 127 | {"keys": ["j", "w"], "command": "ace_jump_word", "description": "jump to word"}, 128 | {"keys": ["j", "l"], "command": "ace_jump_line", "description": "jump to line"}, 129 | {"keys": [""], "command": "ace_jump_char", "description": "jump to char"}, 130 | ] 131 | 132 | sublime_keymap = [ 133 | # Close everything with ESC 134 | {"keys": ["f", "d"], "command": "_enter_normal_mode", "args": {"mode": "mode_insert"}, "context": [{"key": "vi_insert_mode_aware"}, {"key": "sublimious_chain"}]}, 135 | {"keys": ["f", "d"], "command": "_enter_normal_mode", "args": {"mode": "mode_visual_line"}, "context": [{"key": "vi_mode_visual_line"}, {"key": "sublimious_chain"}]}, 136 | {"keys": ["f", "d"], "command": "_enter_normal_mode", "args": {"mode": "mode_visual"}, "context": [{"key": "vi_mode_visual"}, {"key": "sublimious_chain"}]}, 137 | 138 | {"keys": ["f", "d"], "command": "single_selection", "context": [{"key": "num_selections", "operator": "not_equal", "operand": 1}, {"key": "setting.command_mode"}, {"key": "sublimious_chain"}]}, 139 | {"keys": ["f", "d"], "command": "clear_fields", "context": [{"key": "has_next_field", "operator": "equal", "operand": True}, {"key": "setting.command_mode"}, {"key": "sublimious_chain"}]}, 140 | {"keys": ["f", "d"], "command": "clear_fields", "context": [{"key": "has_prev_field", "operator": "equal", "operand": True}, {"key": "setting.command_mode"}, {"key": "sublimious_chain"}]}, 141 | {"keys": ["f", "d"], "command": "hide_panel", "args": {"cancel": True}, "context": [{"key": "panel_visible", "operator": "equal", "operand": True}, {"key": "setting.command_mode"}, {"key": "sublimious_chain"}]}, 142 | {"keys": ["f", "d"], "command": "hide_overlay", "context": [{"key": "overlay_visible", "operator": "equal", "operand": True}, {"key": "sublimious_chain"}]}, 143 | {"keys": ["f", "d"], "command": "hide_popup", "context": [{"key": "popup_visible", "operator": "equal", "operand": True}, {"key": "setting.command_mode"}, {"key": "sublimious_chain"}]}, 144 | {"keys": ["f", "d"], "command": "hide_auto_complete", "context": [{"key": "auto_complete_visible", "operator": "equal", "operand": True}, {"key": "setting.command_mode"}, {"key": "sublimious_chain"}]}, 145 | 146 | # ----- Sidebar nav 147 | {"keys": ["h"], "command": "move", "args": {"by": "characters", "forward": False}, "context": [{"key": "control", "operand": "sidebar_tree"}]}, 148 | {"keys": ["j"], "command": "move", "args": {"by": "lines", "forward": True}, "context": [{"key": "control", "operand": "sidebar_tree"}]}, 149 | {"keys": ["k"], "command": "move", "args": {"by": "lines", "forward": False}, "context": [{"key": "control", "operand": "sidebar_tree"}]}, 150 | {"keys": ["l"], "command": "move", "args": {"by": "characters", "forward": True}, "context": [{"key": "control", "operand": "sidebar_tree"}]}, 151 | 152 | # ----- Overlay nav 153 | {"keys": ["ctrl+j"], "command": "move", "args": {"by": "lines", "forward": True}, "context": [{"key": "overlay_visible", "operator": "equal", "operand": True}]}, 154 | {"keys": ["ctrl+k"], "command": "move", "args": {"by": "lines", "forward": False}, "context": [{"key": "overlay_visible", "operator": "equal", "operand": True}]}, 155 | ] 156 | 157 | syntax_definitions = { 158 | "Python": ['.sublimious'] 159 | } 160 | 161 | def init(self, config): 162 | pass 163 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . --------------------------------------------------------------------------------