Esempio n. 1
0
import sys

import sublime_plugin

if sys.version_info < (3, ):
    from sublime_lib.path import root_at_packages, get_package_name
else:
    from .sublime_lib.path import root_at_packages, get_package_name

PLUGIN_NAME = get_package_name()

COMPLETIONS_SYNTAX_DEF = (
    "Packages/%s/Syntax Definitions/Sublime Completions.tmLanguage" %
    PLUGIN_NAME)
TPL = """{
    "scope": "source.${1:off}",

    "completions": [
        { "trigger": "${2:some_trigger}", "contents": "${3:Hint: Use f, ff and fff plus Tab inside here.}" }$0
    ]
}""".replace("    ", "\t")  # NOQA - line length


class NewCompletionsCommand(sublime_plugin.WindowCommand):
    def run(self):
        v = self.window.new_file()
        v.run_command('insert_snippet', {"contents": TPL})
        v.set_syntax_file(COMPLETIONS_SYNTAX_DEF)
        v.settings().set('default_dir', root_at_packages('User'))
Esempio n. 2
0
import sublime
import sublime_plugin

import os

from sublime_lib.path import root_at_packages, get_package_name

PLUGIN_NAME = get_package_name()


DEBUG = 1

status = sublime.status_message
error = sublime.error_message
join_path = os.path.join
path_exists = os.path.exists

DEFAULT_DIRS = (
    "Snippets",
    "Support",
    "Docs",
    "Macros",
    "bin",
    "data"
)

# name, default template
DEFAULT_FILES = [
    ("LICENSE.txt", None),
    ("README.rst",             "data/README.rst"),
    (".hgignore",              "data/hgignore.txt"),