diff options
| author | Simeon Simeonov | 2026-03-26 10:04:03 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2026-03-26 10:04:03 +0100 |
| commit | 65e85986a18eb0838f406afba56028be52a334da (patch) | |
| tree | 7fa11a61d733fd4e4de314ff599e19a6b2278154 | |
Initial commit
| -rw-r--r-- | snippets/python.json | 125 | ||||
| -rw-r--r-- | snippets/python_sn.json | 125 |
2 files changed, 250 insertions, 0 deletions
diff --git a/snippets/python.json b/snippets/python.json new file mode 100644 index 0000000..215c633 --- /dev/null +++ b/snippets/python.json | |||
| @@ -0,0 +1,125 @@ | |||
| 1 | { | ||
| 2 | // Place your snippets for python here. Each snippet is defined under a snippet name and has a prefix, body and | ||
| 3 | // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | ||
| 4 | // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | ||
| 5 | // same ids are connected. | ||
| 6 | // Example: | ||
| 7 | // "Print to console": { | ||
| 8 | // "prefix": "log", | ||
| 9 | // "body": [ | ||
| 10 | // "console.log('$1');", | ||
| 11 | // "$2" | ||
| 12 | // ], | ||
| 13 | // "description": "Log output to console" | ||
| 14 | // } | ||
| 15 | // | ||
| 16 | // You can also restrict snippets to specific files using include/exclude patterns: | ||
| 17 | // "Test snippet": { | ||
| 18 | // "prefix": "test", | ||
| 19 | // "body": "test('$1', () => {\n\t$0\n});", | ||
| 20 | // "include": ["**/*.test.ts", "*.spec.ts"], | ||
| 21 | // "exclude": ["**/temp/*.ts"], | ||
| 22 | // "description": "Insert test block" | ||
| 23 | // } | ||
| 24 | |||
| 25 | "#!": { | ||
| 26 | "prefix": "#!", | ||
| 27 | "body": "#!/usr/bin/env python" | ||
| 28 | }, | ||
| 29 | "False": { | ||
| 30 | "prefix": "f", | ||
| 31 | "body": "False$0" | ||
| 32 | }, | ||
| 33 | "None": { | ||
| 34 | "prefix": "N", | ||
| 35 | "body": "None$0" | ||
| 36 | }, | ||
| 37 | "True": { | ||
| 38 | "prefix": "t", | ||
| 39 | "body": "True$0" | ||
| 40 | }, | ||
| 41 | "assert": { | ||
| 42 | "prefix": "ass", | ||
| 43 | "body": "assert $0" | ||
| 44 | }, | ||
| 45 | "doc": { | ||
| 46 | "prefix": "d", | ||
| 47 | "body": "\"\"\"$0\n\"\"\"\n" | ||
| 48 | }, | ||
| 49 | "docstring_oneliner": { | ||
| 50 | "prefix": "do", | ||
| 51 | "body": "\"\"\"$0\"\"\"" | ||
| 52 | }, | ||
| 53 | "docstring_param": { | ||
| 54 | "prefix": "Par", | ||
| 55 | "body": ":param $1: $0\n:type $1: " | ||
| 56 | }, | ||
| 57 | "docstring_return": { | ||
| 58 | "prefix": "Ret", | ||
| 59 | "body": ":return: $0\n:rtype: " | ||
| 60 | }, | ||
| 61 | "dunder": { | ||
| 62 | "prefix": "dd", | ||
| 63 | "body": "__${name}__$0" | ||
| 64 | }, | ||
| 65 | "enc": { | ||
| 66 | "prefix": "enc", | ||
| 67 | "body": "# -*- coding: utf-8 -*-\n" | ||
| 68 | }, | ||
| 69 | "ifmain": { | ||
| 70 | "prefix": "ifm", | ||
| 71 | "body": "if __name__ == '__main__':\n ${1:main()}" | ||
| 72 | }, | ||
| 73 | "lambda": { | ||
| 74 | "prefix": "lam", | ||
| 75 | "body": "lambda ${1:x}: $0" | ||
| 76 | }, | ||
| 77 | "not_impl": { | ||
| 78 | "prefix": "ni", | ||
| 79 | "body": "raise NotImplementedError" | ||
| 80 | }, | ||
| 81 | "print": { | ||
| 82 | "prefix": "p", | ||
| 83 | "body": "print('$0')" | ||
| 84 | }, | ||
| 85 | "printf": { | ||
| 86 | "prefix": "pf", | ||
| 87 | "body": "print(f'$0')" | ||
| 88 | }, | ||
| 89 | "property": { | ||
| 90 | "prefix": "@", | ||
| 91 | "body": "@property\n$0" | ||
| 92 | }, | ||
| 93 | "property_getter": { | ||
| 94 | "prefix": "pg", | ||
| 95 | "body": "@property\ndef ${1:name}(self):\n \"\"\"$1-property\"\"\"\n return self._${1}\n$0" | ||
| 96 | }, | ||
| 97 | "property_setter": { | ||
| 98 | "prefix": "ps", | ||
| 99 | "body": "@property\ndef ${1:name}(self):\n \"\"\"$1-property\"\"\"\n return self._${1}\n\n@$1.setter\ndef $1(self, value):\n \"\"\"$1-property setter\"\"\"\n self._$1 = value\n$0" | ||
| 100 | }, | ||
| 101 | "return": { | ||
| 102 | "prefix": "r", | ||
| 103 | "body": "return $0" | ||
| 104 | }, | ||
| 105 | "script": { | ||
| 106 | "prefix": "script", | ||
| 107 | "body": "#!/usr/bin/env python\n\n\ndef main(inargs=None):\n \"\"\"main entry point\"\"\"\n $0\n\nif __name__ == '__main__':\n main()\n" | ||
| 108 | }, | ||
| 109 | "self": { | ||
| 110 | "prefix": ".", | ||
| 111 | "body": "self.$0" | ||
| 112 | }, | ||
| 113 | "self_without_dot": { | ||
| 114 | "prefix": "s", | ||
| 115 | "body": "self" | ||
| 116 | }, | ||
| 117 | "selfassign": { | ||
| 118 | "prefix": "sn", | ||
| 119 | "body": "self._$1 = $1" | ||
| 120 | }, | ||
| 121 | "static": { | ||
| 122 | "prefix": "sm", | ||
| 123 | "body": "@staticmethod\ndef ${1:func}($0):\n" | ||
| 124 | } | ||
| 125 | } | ||
diff --git a/snippets/python_sn.json b/snippets/python_sn.json new file mode 100644 index 0000000..3a59c9d --- /dev/null +++ b/snippets/python_sn.json | |||
| @@ -0,0 +1,125 @@ | |||
| 1 | { | ||
| 2 | // Place your snippets for python here. Each snippet is defined under a snippet name and has a prefix, body and | ||
| 3 | // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | ||
| 4 | // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | ||
| 5 | // same ids are connected. | ||
| 6 | // Example: | ||
| 7 | // "Print to console": { | ||
| 8 | // "prefix": "log", | ||
| 9 | // "body": [ | ||
| 10 | // "console.log('$1');", | ||
| 11 | // "$2" | ||
| 12 | // ], | ||
| 13 | // "description": "Log output to console" | ||
| 14 | // } | ||
| 15 | // | ||
| 16 | // You can also restrict snippets to specific files using include/exclude patterns: | ||
| 17 | // "Test snippet": { | ||
| 18 | // "prefix": "test", | ||
| 19 | // "body": "test('$1', () => {\n\t$0\n});", | ||
| 20 | // "include": ["**/*.test.ts", "*.spec.ts"], | ||
| 21 | // "exclude": ["**/temp/*.ts"], | ||
| 22 | // "description": "Insert test block" | ||
| 23 | // } | ||
| 24 | |||
| 25 | "#!": { | ||
| 26 | "prefix": "#!", | ||
| 27 | "body": "#!/usr/bin/env python" | ||
| 28 | }, | ||
| 29 | "False": { | ||
| 30 | "prefix": "f", | ||
| 31 | "body": "False$0" | ||
| 32 | }, | ||
| 33 | "None": { | ||
| 34 | "prefix": "N", | ||
| 35 | "body": "None$0" | ||
| 36 | }, | ||
| 37 | "True": { | ||
| 38 | "prefix": "t", | ||
| 39 | "body": "True$0" | ||
| 40 | }, | ||
| 41 | "assert": { | ||
| 42 | "prefix": "ass", | ||
| 43 | "body": "assert $0" | ||
| 44 | }, | ||
| 45 | "doc": { | ||
| 46 | "prefix": "d", | ||
| 47 | "body": "\"\"\"$0\n\"\"\"\n" | ||
| 48 | }, | ||
| 49 | "docstring_oneliner": { | ||
| 50 | "prefix": "do", | ||
| 51 | "body": "\"\"\"$0\"\"\"" | ||
| 52 | }, | ||
| 53 | "docstring_param": { | ||
| 54 | "prefix": "Par", | ||
| 55 | "body": ":param $1: $0\n:type $1: " | ||
| 56 | }, | ||
| 57 | "docstring_return": { | ||
| 58 | "prefix": "Ret", | ||
| 59 | "body": ":return: $0\n:rtype: " | ||
| 60 | }, | ||
| 61 | "dunder": { | ||
| 62 | "prefix": "dd", | ||
| 63 | "body": "__${name}__$0" | ||
| 64 | }, | ||
| 65 | "enc": { | ||
| 66 | "prefix": "enc", | ||
| 67 | "body": "# -*- coding: utf-8 -*-\n" | ||
| 68 | }, | ||
| 69 | "ifmain": { | ||
| 70 | "prefix": "ifm", | ||
| 71 | "body": "if __name__ == \"__main__\":\n ${1:main()}" | ||
| 72 | }, | ||
| 73 | "lambda": { | ||
| 74 | "prefix": "lam", | ||
| 75 | "body": "lambda ${1:x}: $0" | ||
| 76 | }, | ||
| 77 | "not_impl": { | ||
| 78 | "prefix": "ni", | ||
| 79 | "body": "raise NotImplementedError" | ||
| 80 | }, | ||
| 81 | "print": { | ||
| 82 | "prefix": "p", | ||
| 83 | "body": "print(\"$0\")" | ||
| 84 | }, | ||
| 85 | "printf": { | ||
| 86 | "prefix": "pf", | ||
| 87 | "body": "print(f\"$0\")" | ||
| 88 | }, | ||
| 89 | "property": { | ||
| 90 | "prefix": "@", | ||
| 91 | "body": "@property\n$0" | ||
| 92 | }, | ||
| 93 | "property_getter": { | ||
| 94 | "prefix": "pg", | ||
| 95 | "body": "@property\ndef ${1:name}(self):\n \"\"\"$1-property\"\"\"\n return self._${1}\n$0" | ||
| 96 | }, | ||
| 97 | "property_setter": { | ||
| 98 | "prefix": "ps", | ||
| 99 | "body": "@property\ndef ${1:name}(self):\n \"\"\"$1-property\"\"\"\n return self._${1}\n\n@$1.setter\ndef $1(self, value):\n \"\"\"$1-property setter\"\"\"\n self._$1 = value\n$0" | ||
| 100 | }, | ||
| 101 | "return": { | ||
| 102 | "prefix": "r", | ||
| 103 | "body": "return $0" | ||
| 104 | }, | ||
| 105 | "script": { | ||
| 106 | "prefix": "script", | ||
| 107 | "body": "#!/usr/bin/env python\n\n\ndef main(inargs=None):\n \"\"\"main entry point\"\"\"\n $0\n\nif __name__ == \"__main__\":\n main()\n" | ||
| 108 | }, | ||
| 109 | "self": { | ||
| 110 | "prefix": ".", | ||
| 111 | "body": "self.$0" | ||
| 112 | }, | ||
| 113 | "self_without_dot": { | ||
| 114 | "prefix": "s", | ||
| 115 | "body": "self" | ||
| 116 | }, | ||
| 117 | "selfassign": { | ||
| 118 | "prefix": "sn", | ||
| 119 | "body": "self._$1 = $1" | ||
| 120 | }, | ||
| 121 | "static": { | ||
| 122 | "prefix": "sm", | ||
| 123 | "body": "@staticmethod\ndef ${1:func}($0):\n" | ||
| 124 | } | ||
| 125 | } | ||
