turbo-editors/turbo-pythonpublic Fork 0
main
Commits
Clone
git clone https://git.rickub.com/turbo-editors/turbo-python.git
git clone ssh://git@rickub.com/turbo-editors/turbo-python.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

snippets.toml.tmpl · 88 lines · 1.8 KBCheetah Blame HistoryRaw
📦 Turbo Python 6fc62ea k33g 9h ago1# turbo-python snippets.
2#
3# Each [[snippet]] becomes one line of the Snippets menu. Snippets sharing a
4# group appear together in a submenu of that name; one with no group goes into
5# %s. A snippet is inserted at the cursor, and every line after the
6# first is indented to match the line you inserted it on.
7#
8# languages restricts a snippet to files of those kinds, by the names the
9# editor uses: python, toml, yaml, markdown, javascript, html, xml, dockerfile,
10# bash. Leave it out and the snippet is offered everywhere.
11#
12# Bodies are indented with four spaces, never a tab: that is what PEP 8 asks
13# for, and a tab inserted into a file indented with spaces is an indentation
14# error rather than a formatting quibble.
15#
16# Your own snippets, shared across every project, go in:
17# %s
18
19[[snippet]]
20name = "main guard"
21group = "Python"
22languages = ["python"]
23body = """
24def main() -> None:
25 ...
26
27
28if __name__ == "__main__":
29 main()"""
30
31[[snippet]]
32name = "class"
33group = "Python"
34languages = ["python"]
35body = """
36class Thing:
37 def __init__(self, name: str) -> None:
38 self.name = name"""
39
40[[snippet]]
41name = "match"
42group = "Python"
43languages = ["python"]
44body = """
45match value:
46 case 0:
47 ...
48 case _:
49 ..."""
50
51[[snippet]]
52name = "try / except"
53group = "Python"
54languages = ["python"]
55body = """
56try:
57 ...
58except ValueError as error:
59 raise SystemExit(error) from error"""
60
61[[snippet]]
62name = "dataclass"
63group = "Python"
64languages = ["python"]
65body = """
66@dataclass(frozen=True)
67class Thing:
68 name: str
69 count: int = 0"""
70
71[[snippet]]
72name = "test"
73group = "Python"
74languages = ["python"]
75body = """
76def test_it_works() -> None:
77 assert 1 + 1 == 2"""
78
79[[snippet]]
80group = "General"
81name = "Hello"
82body = "Hello!!!"
83
84[[snippet]]
85group = "Markdown"
86name = "Image"
87languages = ["markdown"]
88body = "![img](./pictures)"