forked from SublimeText/PackageDev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompletions_dev.py
More file actions
25 lines (18 loc) · 790 Bytes
/
Copy pathcompletions_dev.py
File metadata and controls
25 lines (18 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import os
from sublime import packages_path
import sublime_plugin
from sublime_lib.path import root_at_packages
PLUGIN_NAME = os.getcwdu().replace(packages_path(), '')[1:]
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
]
}"""
class NewCompletionsCommand(sublime_plugin.WindowCommand):
def run(self):
v = self.window.new_file()
v.run_command('insert_snippet', {"contents": TPL})
v.settings().set('syntax', COMPLETIONS_SYNTAX_DEF)
v.settings().set('default_dir', root_at_packages('User'))