From 65e85986a18eb0838f406afba56028be52a334da Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Thu, 26 Mar 2026 10:04:03 +0100 Subject: Initial commit --- snippets/python.json | 125 ++++++++++++++++++++++++++++++++++++++++++++++++ snippets/python_sn.json | 125 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 250 insertions(+) create mode 100644 snippets/python.json create mode 100644 snippets/python_sn.json (limited to 'snippets') 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 @@ +{ + // Place your snippets for python here. Each snippet is defined under a snippet name and has a prefix, body and + // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: + // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the + // same ids are connected. + // Example: + // "Print to console": { + // "prefix": "log", + // "body": [ + // "console.log('$1');", + // "$2" + // ], + // "description": "Log output to console" + // } + // + // You can also restrict snippets to specific files using include/exclude patterns: + // "Test snippet": { + // "prefix": "test", + // "body": "test('$1', () => {\n\t$0\n});", + // "include": ["**/*.test.ts", "*.spec.ts"], + // "exclude": ["**/temp/*.ts"], + // "description": "Insert test block" + // } + + "#!": { + "prefix": "#!", + "body": "#!/usr/bin/env python" + }, + "False": { + "prefix": "f", + "body": "False$0" + }, + "None": { + "prefix": "N", + "body": "None$0" + }, + "True": { + "prefix": "t", + "body": "True$0" + }, + "assert": { + "prefix": "ass", + "body": "assert $0" + }, + "doc": { + "prefix": "d", + "body": "\"\"\"$0\n\"\"\"\n" + }, + "docstring_oneliner": { + "prefix": "do", + "body": "\"\"\"$0\"\"\"" + }, + "docstring_param": { + "prefix": "Par", + "body": ":param $1: $0\n:type $1: " + }, + "docstring_return": { + "prefix": "Ret", + "body": ":return: $0\n:rtype: " + }, + "dunder": { + "prefix": "dd", + "body": "__${name}__$0" + }, + "enc": { + "prefix": "enc", + "body": "# -*- coding: utf-8 -*-\n" + }, + "ifmain": { + "prefix": "ifm", + "body": "if __name__ == '__main__':\n ${1:main()}" + }, + "lambda": { + "prefix": "lam", + "body": "lambda ${1:x}: $0" + }, + "not_impl": { + "prefix": "ni", + "body": "raise NotImplementedError" + }, + "print": { + "prefix": "p", + "body": "print('$0')" + }, + "printf": { + "prefix": "pf", + "body": "print(f'$0')" + }, + "property": { + "prefix": "@", + "body": "@property\n$0" + }, + "property_getter": { + "prefix": "pg", + "body": "@property\ndef ${1:name}(self):\n \"\"\"$1-property\"\"\"\n return self._${1}\n$0" + }, + "property_setter": { + "prefix": "ps", + "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" + }, + "return": { + "prefix": "r", + "body": "return $0" + }, + "script": { + "prefix": "script", + "body": "#!/usr/bin/env python\n\n\ndef main(inargs=None):\n \"\"\"main entry point\"\"\"\n $0\n\nif __name__ == '__main__':\n main()\n" + }, + "self": { + "prefix": ".", + "body": "self.$0" + }, + "self_without_dot": { + "prefix": "s", + "body": "self" + }, + "selfassign": { + "prefix": "sn", + "body": "self._$1 = $1" + }, + "static": { + "prefix": "sm", + "body": "@staticmethod\ndef ${1:func}($0):\n" + } +} 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 @@ +{ + // Place your snippets for python here. Each snippet is defined under a snippet name and has a prefix, body and + // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: + // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the + // same ids are connected. + // Example: + // "Print to console": { + // "prefix": "log", + // "body": [ + // "console.log('$1');", + // "$2" + // ], + // "description": "Log output to console" + // } + // + // You can also restrict snippets to specific files using include/exclude patterns: + // "Test snippet": { + // "prefix": "test", + // "body": "test('$1', () => {\n\t$0\n});", + // "include": ["**/*.test.ts", "*.spec.ts"], + // "exclude": ["**/temp/*.ts"], + // "description": "Insert test block" + // } + + "#!": { + "prefix": "#!", + "body": "#!/usr/bin/env python" + }, + "False": { + "prefix": "f", + "body": "False$0" + }, + "None": { + "prefix": "N", + "body": "None$0" + }, + "True": { + "prefix": "t", + "body": "True$0" + }, + "assert": { + "prefix": "ass", + "body": "assert $0" + }, + "doc": { + "prefix": "d", + "body": "\"\"\"$0\n\"\"\"\n" + }, + "docstring_oneliner": { + "prefix": "do", + "body": "\"\"\"$0\"\"\"" + }, + "docstring_param": { + "prefix": "Par", + "body": ":param $1: $0\n:type $1: " + }, + "docstring_return": { + "prefix": "Ret", + "body": ":return: $0\n:rtype: " + }, + "dunder": { + "prefix": "dd", + "body": "__${name}__$0" + }, + "enc": { + "prefix": "enc", + "body": "# -*- coding: utf-8 -*-\n" + }, + "ifmain": { + "prefix": "ifm", + "body": "if __name__ == \"__main__\":\n ${1:main()}" + }, + "lambda": { + "prefix": "lam", + "body": "lambda ${1:x}: $0" + }, + "not_impl": { + "prefix": "ni", + "body": "raise NotImplementedError" + }, + "print": { + "prefix": "p", + "body": "print(\"$0\")" + }, + "printf": { + "prefix": "pf", + "body": "print(f\"$0\")" + }, + "property": { + "prefix": "@", + "body": "@property\n$0" + }, + "property_getter": { + "prefix": "pg", + "body": "@property\ndef ${1:name}(self):\n \"\"\"$1-property\"\"\"\n return self._${1}\n$0" + }, + "property_setter": { + "prefix": "ps", + "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" + }, + "return": { + "prefix": "r", + "body": "return $0" + }, + "script": { + "prefix": "script", + "body": "#!/usr/bin/env python\n\n\ndef main(inargs=None):\n \"\"\"main entry point\"\"\"\n $0\n\nif __name__ == \"__main__\":\n main()\n" + }, + "self": { + "prefix": ".", + "body": "self.$0" + }, + "self_without_dot": { + "prefix": "s", + "body": "self" + }, + "selfassign": { + "prefix": "sn", + "body": "self._$1 = $1" + }, + "static": { + "prefix": "sm", + "body": "@staticmethod\ndef ${1:func}($0):\n" + } +} -- cgit v1.3