1

Sublime Text 2 のスニペットをたくさん作成しています。オプションのタブ トリガーを常に使用し、トリガー スコープは使用しません。「新しいスニペット」テンプレートを編集して、毎回これらの各オプションのコメントを外して削除する必要がないようにしたいと思います。

TL;DR - このデフォルトの「新しいスニペット」テキストはどこから来たので、変更できますか:

<snippet>
    <content><![CDATA[
Hello, ${1:this} is a ${2:snippet}.
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <!-- <tabTrigger>hello</tabTrigger> -->
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <!-- <scope>source.python</scope> -->
</snippet>
4

1 に答える 1

4

新しいスニペット コマンドはPackages/Default/new_templates.pyで定義されています。そこで編集します。(Sublime でPackagesを開き、その行の 1 つを検索して見つけました。

class NewSnippetCommand(sublime_plugin.WindowCommand):
    def run(self):
        v = self.window.new_file()
        v.settings().set('default_dir',
            os.path.join(sublime.packages_path(), 'User'))
        v.settings().set('default_extension', 'sublime-snippet')
        v.set_syntax_file('Packages/XML/XML.tmLanguage')

        template = """<snippet>
    <content><![CDATA[
Hello, \${1:this} is a \${2:snippet}.
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <!-- <tabTrigger>hello</tabTrigger> -->
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <!-- <scope>source.python</scope> -->
</snippet>
"""
于 2013-05-01T20:30:21.243 に答える