From 897eee81de8b3f6adf0165f50e95600a7b89c20c Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Wed, 4 Feb 2015 21:41:42 +0100 Subject: Standalone lisp and snippet repo --- .emacs.d/snippets/.nosearch | 1 + .emacs.d/snippets/c-mode/.yas-parents | 1 + .emacs.d/snippets/c-mode/assert | 6 ++++++ .emacs.d/snippets/c-mode/compile | 5 +++++ .emacs.d/snippets/c-mode/define | 5 +++++ .emacs.d/snippets/c-mode/fopen | 4 ++++ .emacs.d/snippets/c-mode/malloc | 6 ++++++ .emacs.d/snippets/c-mode/packed | 5 +++++ .emacs.d/snippets/c-mode/printf | 5 +++++ .emacs.d/snippets/c-mode/stdio | 5 +++++ .emacs.d/snippets/c-mode/stdlib | 5 +++++ .emacs.d/snippets/c-mode/string | 5 +++++ .emacs.d/snippets/c-mode/switch | 11 +++++++++++ .emacs.d/snippets/c-mode/union | 7 +++++++ .emacs.d/snippets/c-mode/unistd | 5 +++++ .emacs.d/snippets/python-mode/.yas-parents | 1 + .emacs.d/snippets/python-mode/.yas-setup.el | 22 ++++++++++++++++++++++ .emacs.d/snippets/python-mode/__getitem__ | 7 +++++++ .emacs.d/snippets/python-mode/__setitem__ | 7 +++++++ .emacs.d/snippets/python-mode/arg | 7 +++++++ .emacs.d/snippets/python-mode/classmethod | 10 ++++++++++ .emacs.d/snippets/python-mode/cls | 7 +++++++ .emacs.d/snippets/python-mode/dec | 14 ++++++++++++++ .emacs.d/snippets/python-mode/deftest | 7 +++++++ .emacs.d/snippets/python-mode/doc | 6 ++++++ .emacs.d/snippets/python-mode/eq | 7 +++++++ .emacs.d/snippets/python-mode/for | 6 ++++++ .emacs.d/snippets/python-mode/from | 6 ++++++ .emacs.d/snippets/python-mode/function | 7 +++++++ .emacs.d/snippets/python-mode/function_docstring | 10 ++++++++++ .emacs.d/snippets/python-mode/ife | 9 +++++++++ .emacs.d/snippets/python-mode/ifmain | 6 ++++++ .emacs.d/snippets/python-mode/import | 7 +++++++ .emacs.d/snippets/python-mode/init_docstring | 10 ++++++++++ .emacs.d/snippets/python-mode/lambda | 5 +++++ .emacs.d/snippets/python-mode/list | 7 +++++++ .emacs.d/snippets/python-mode/method | 7 +++++++ .emacs.d/snippets/python-mode/method_docstring | 10 ++++++++++ .emacs.d/snippets/python-mode/not_impl | 5 +++++ .emacs.d/snippets/python-mode/parse_args | 9 +++++++++ .emacs.d/snippets/python-mode/parser | 7 +++++++ .emacs.d/snippets/python-mode/print | 5 +++++ .emacs.d/snippets/python-mode/reg | 7 +++++++ .emacs.d/snippets/python-mode/repr | 7 +++++++ .emacs.d/snippets/python-mode/return | 5 +++++ .emacs.d/snippets/python-mode/script | 13 +++++++++++++ .emacs.d/snippets/python-mode/self | 6 ++++++ .emacs.d/snippets/python-mode/self_without_dot | 6 ++++++ .emacs.d/snippets/python-mode/selfassign | 6 ++++++ .emacs.d/snippets/python-mode/static | 6 ++++++ .emacs.d/snippets/python-mode/str | 7 +++++++ .emacs.d/snippets/python-mode/try | 8 ++++++++ .emacs.d/snippets/python-mode/unicode | 7 +++++++ .emacs.d/snippets/python-mode/utf8 | 5 +++++ .emacs.d/snippets/python-mode/while | 7 +++++++ .emacs.d/snippets/python-mode/with | 7 +++++++ 56 files changed, 384 insertions(+) create mode 100644 .emacs.d/snippets/.nosearch create mode 100644 .emacs.d/snippets/c-mode/.yas-parents create mode 100644 .emacs.d/snippets/c-mode/assert create mode 100644 .emacs.d/snippets/c-mode/compile create mode 100644 .emacs.d/snippets/c-mode/define create mode 100644 .emacs.d/snippets/c-mode/fopen create mode 100644 .emacs.d/snippets/c-mode/malloc create mode 100644 .emacs.d/snippets/c-mode/packed create mode 100644 .emacs.d/snippets/c-mode/printf create mode 100644 .emacs.d/snippets/c-mode/stdio create mode 100644 .emacs.d/snippets/c-mode/stdlib create mode 100644 .emacs.d/snippets/c-mode/string create mode 100644 .emacs.d/snippets/c-mode/switch create mode 100644 .emacs.d/snippets/c-mode/union create mode 100644 .emacs.d/snippets/c-mode/unistd create mode 100644 .emacs.d/snippets/python-mode/.yas-parents create mode 100644 .emacs.d/snippets/python-mode/.yas-setup.el create mode 100644 .emacs.d/snippets/python-mode/__getitem__ create mode 100644 .emacs.d/snippets/python-mode/__setitem__ create mode 100644 .emacs.d/snippets/python-mode/arg create mode 100644 .emacs.d/snippets/python-mode/classmethod create mode 100644 .emacs.d/snippets/python-mode/cls create mode 100644 .emacs.d/snippets/python-mode/dec create mode 100644 .emacs.d/snippets/python-mode/deftest create mode 100644 .emacs.d/snippets/python-mode/doc create mode 100644 .emacs.d/snippets/python-mode/eq create mode 100644 .emacs.d/snippets/python-mode/for create mode 100644 .emacs.d/snippets/python-mode/from create mode 100644 .emacs.d/snippets/python-mode/function create mode 100644 .emacs.d/snippets/python-mode/function_docstring create mode 100644 .emacs.d/snippets/python-mode/ife create mode 100644 .emacs.d/snippets/python-mode/ifmain create mode 100644 .emacs.d/snippets/python-mode/import create mode 100644 .emacs.d/snippets/python-mode/init_docstring create mode 100644 .emacs.d/snippets/python-mode/lambda create mode 100644 .emacs.d/snippets/python-mode/list create mode 100644 .emacs.d/snippets/python-mode/method create mode 100644 .emacs.d/snippets/python-mode/method_docstring create mode 100644 .emacs.d/snippets/python-mode/not_impl create mode 100644 .emacs.d/snippets/python-mode/parse_args create mode 100644 .emacs.d/snippets/python-mode/parser create mode 100644 .emacs.d/snippets/python-mode/print create mode 100644 .emacs.d/snippets/python-mode/reg create mode 100644 .emacs.d/snippets/python-mode/repr create mode 100644 .emacs.d/snippets/python-mode/return create mode 100644 .emacs.d/snippets/python-mode/script create mode 100644 .emacs.d/snippets/python-mode/self create mode 100644 .emacs.d/snippets/python-mode/self_without_dot create mode 100644 .emacs.d/snippets/python-mode/selfassign create mode 100644 .emacs.d/snippets/python-mode/static create mode 100644 .emacs.d/snippets/python-mode/str create mode 100644 .emacs.d/snippets/python-mode/try create mode 100644 .emacs.d/snippets/python-mode/unicode create mode 100644 .emacs.d/snippets/python-mode/utf8 create mode 100644 .emacs.d/snippets/python-mode/while create mode 100644 .emacs.d/snippets/python-mode/with (limited to '.emacs.d/snippets') diff --git a/.emacs.d/snippets/.nosearch b/.emacs.d/snippets/.nosearch new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/.emacs.d/snippets/.nosearch @@ -0,0 +1 @@ + diff --git a/.emacs.d/snippets/c-mode/.yas-parents b/.emacs.d/snippets/c-mode/.yas-parents new file mode 100644 index 0000000..ce9828b --- /dev/null +++ b/.emacs.d/snippets/c-mode/.yas-parents @@ -0,0 +1 @@ +cc-mode diff --git a/.emacs.d/snippets/c-mode/assert b/.emacs.d/snippets/c-mode/assert new file mode 100644 index 0000000..964205e --- /dev/null +++ b/.emacs.d/snippets/c-mode/assert @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: assert +# key: ass +# -- +#include +$0 \ No newline at end of file diff --git a/.emacs.d/snippets/c-mode/compile b/.emacs.d/snippets/c-mode/compile new file mode 100644 index 0000000..8246a10 --- /dev/null +++ b/.emacs.d/snippets/c-mode/compile @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: compile +# key: compile +# -- +// -*- compile-command: "${1:gcc -Wall -o ${2:dest} ${3:file}}" -*- \ No newline at end of file diff --git a/.emacs.d/snippets/c-mode/define b/.emacs.d/snippets/c-mode/define new file mode 100644 index 0000000..9d5c5dd --- /dev/null +++ b/.emacs.d/snippets/c-mode/define @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: define +# key: d +# -- +#define $0 \ No newline at end of file diff --git a/.emacs.d/snippets/c-mode/fopen b/.emacs.d/snippets/c-mode/fopen new file mode 100644 index 0000000..0e48c21 --- /dev/null +++ b/.emacs.d/snippets/c-mode/fopen @@ -0,0 +1,4 @@ +#name : FILE *fp = fopen(..., ...); +# key: fopen +# -- +FILE *${fp} = fopen(${"file"}, "${r}"); \ No newline at end of file diff --git a/.emacs.d/snippets/c-mode/malloc b/.emacs.d/snippets/c-mode/malloc new file mode 100644 index 0000000..2a51de3 --- /dev/null +++ b/.emacs.d/snippets/c-mode/malloc @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: malloc +# key: malloc +# -- +malloc(sizeof($1)${2: * ${3:3}}); +$0 \ No newline at end of file diff --git a/.emacs.d/snippets/c-mode/packed b/.emacs.d/snippets/c-mode/packed new file mode 100644 index 0000000..b4eb125 --- /dev/null +++ b/.emacs.d/snippets/c-mode/packed @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: packed +# key: packed +# -- +__attribute__((__packed__))$0 \ No newline at end of file diff --git a/.emacs.d/snippets/c-mode/printf b/.emacs.d/snippets/c-mode/printf new file mode 100644 index 0000000..ccc788c --- /dev/null +++ b/.emacs.d/snippets/c-mode/printf @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: printf +# key: pr +# -- +printf("${1:format string}"${2: ,a0,a1}); \ No newline at end of file diff --git a/.emacs.d/snippets/c-mode/stdio b/.emacs.d/snippets/c-mode/stdio new file mode 100644 index 0000000..7529766 --- /dev/null +++ b/.emacs.d/snippets/c-mode/stdio @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: stdio +# key: io +# -- +#include \ No newline at end of file diff --git a/.emacs.d/snippets/c-mode/stdlib b/.emacs.d/snippets/c-mode/stdlib new file mode 100644 index 0000000..a7d117b --- /dev/null +++ b/.emacs.d/snippets/c-mode/stdlib @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: stdlib +# key: std +# -- +#include diff --git a/.emacs.d/snippets/c-mode/string b/.emacs.d/snippets/c-mode/string new file mode 100644 index 0000000..d45b757 --- /dev/null +++ b/.emacs.d/snippets/c-mode/string @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: string +# key: str +# -- +#include \ No newline at end of file diff --git a/.emacs.d/snippets/c-mode/switch b/.emacs.d/snippets/c-mode/switch new file mode 100644 index 0000000..0916059 --- /dev/null +++ b/.emacs.d/snippets/c-mode/switch @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: switch +# key: case +# -- +switch (${1:ch}) { + case ${2:const}: + ${3:a = b}; + break; + ${4:default: + ${5:action}} +} diff --git a/.emacs.d/snippets/c-mode/union b/.emacs.d/snippets/c-mode/union new file mode 100644 index 0000000..b4ec5fa --- /dev/null +++ b/.emacs.d/snippets/c-mode/union @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: union +# key: union +# -- +typedef union { + $0 +} ${1:name}; \ No newline at end of file diff --git a/.emacs.d/snippets/c-mode/unistd b/.emacs.d/snippets/c-mode/unistd new file mode 100644 index 0000000..d5fca02 --- /dev/null +++ b/.emacs.d/snippets/c-mode/unistd @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: unistd +# key: uni +# -- +#include \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/.yas-parents b/.emacs.d/snippets/python-mode/.yas-parents new file mode 100644 index 0000000..75d003f --- /dev/null +++ b/.emacs.d/snippets/python-mode/.yas-parents @@ -0,0 +1 @@ +prog-mode diff --git a/.emacs.d/snippets/python-mode/.yas-setup.el b/.emacs.d/snippets/python-mode/.yas-setup.el new file mode 100644 index 0000000..6635232 --- /dev/null +++ b/.emacs.d/snippets/python-mode/.yas-setup.el @@ -0,0 +1,22 @@ +(defun python-split-args (arg-string) + "Split a python argument string into ((name, default)..) tuples" + (mapcar (lambda (x) + (split-string x "[[:blank:]]*=[[:blank:]]*" t)) + (split-string arg-string "[[:blank:]]*,[[:blank:]]*" t))) + +(defun python-args-to-docstring () + "return docstring format for the python arguments in yas-text" + (let* ((indent (concat "\n" (make-string (current-column) 32))) + (args (python-split-args yas-text)) + (max-len (if args (apply 'max (mapcar (lambda (x) (length (nth 0 x))) args)) 0)) + (formatted-args (mapconcat + (lambda (x) + (concat (nth 0 x) (make-string (- max-len (length (nth 0 x))) ? ) " -- " + (if (nth 1 x) (concat "\(default " (nth 1 x) "\)")))) + args + indent))) + (unless (string= formatted-args "") + (mapconcat 'identity (list "Keyword Arguments:" formatted-args) indent)))) + +(add-hook 'python-mode-hook + '(lambda () (set (make-local-variable 'yas-indent-line) 'fixed))) diff --git a/.emacs.d/snippets/python-mode/__getitem__ b/.emacs.d/snippets/python-mode/__getitem__ new file mode 100644 index 0000000..939bd1a --- /dev/null +++ b/.emacs.d/snippets/python-mode/__getitem__ @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: __getitem__ +# key: getit +# group: dunder methods +# -- +def __getitem__(self, ${1:key}): + $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/__setitem__ b/.emacs.d/snippets/python-mode/__setitem__ new file mode 100644 index 0000000..c7db5b1 --- /dev/null +++ b/.emacs.d/snippets/python-mode/__setitem__ @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: __setitem__ +# key: setit +# group: dunder methods +# -- +def __setitem__(self, ${1:key}, ${2:val}): + $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/arg b/.emacs.d/snippets/python-mode/arg new file mode 100644 index 0000000..f5145ec --- /dev/null +++ b/.emacs.d/snippets/python-mode/arg @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: arg +# key: arg +# group: argparser +# -- +parser.add_argument('-$1', '--$2', + $0) diff --git a/.emacs.d/snippets/python-mode/classmethod b/.emacs.d/snippets/python-mode/classmethod new file mode 100644 index 0000000..aa78440 --- /dev/null +++ b/.emacs.d/snippets/python-mode/classmethod @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: classmethod +# key: cm +# group: object oriented +# -- +@classmethod +def ${1:meth}(cls, $2): + """ + """ + $3 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/cls b/.emacs.d/snippets/python-mode/cls new file mode 100644 index 0000000..9f8b27c --- /dev/null +++ b/.emacs.d/snippets/python-mode/cls @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: cls +# key: cls +# group: object oriented +# -- +class ${1:class}: + $0 diff --git a/.emacs.d/snippets/python-mode/dec b/.emacs.d/snippets/python-mode/dec new file mode 100644 index 0000000..b22c9e9 --- /dev/null +++ b/.emacs.d/snippets/python-mode/dec @@ -0,0 +1,14 @@ +# -*- mode: snippet -*- +# name: dec +# key: dec +# group : definitions +# -- +def ${1:decorator}(func): + $2 + def _$1(*args, **kwargs): + $3 + ret = func(*args, **kwargs) + $4 + return ret + + return _$1 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/deftest b/.emacs.d/snippets/python-mode/deftest new file mode 100644 index 0000000..394553a --- /dev/null +++ b/.emacs.d/snippets/python-mode/deftest @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: deftest +# key: dt +# group: testing +# -- +def test_${1:long_name}(self): + $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/doc b/.emacs.d/snippets/python-mode/doc new file mode 100644 index 0000000..2929e78 --- /dev/null +++ b/.emacs.d/snippets/python-mode/doc @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: doc +# key: d +# -- +"""$0 +""" \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/eq b/.emacs.d/snippets/python-mode/eq new file mode 100644 index 0000000..e19c328 --- /dev/null +++ b/.emacs.d/snippets/python-mode/eq @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: __eq__ +# key: eq +# group: dunder methods +# -- +def __eq__(self, other): + return self.$1 == other.$1 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/for b/.emacs.d/snippets/python-mode/for new file mode 100644 index 0000000..0033c87 --- /dev/null +++ b/.emacs.d/snippets/python-mode/for @@ -0,0 +1,6 @@ +# name: for ... in ... : ... +# key: for +# group : control structure +# -- +for ${var} in ${collection}: + $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/from b/.emacs.d/snippets/python-mode/from new file mode 100644 index 0000000..3a4acfc --- /dev/null +++ b/.emacs.d/snippets/python-mode/from @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: from +# key: from +# group : general +# -- +from ${1:lib} import ${2:funs} \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/function b/.emacs.d/snippets/python-mode/function new file mode 100644 index 0000000..d7e8f12 --- /dev/null +++ b/.emacs.d/snippets/python-mode/function @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: function +# key: f +# group: definitions +# -- +def ${1:fun}(${2:args}): + $0 diff --git a/.emacs.d/snippets/python-mode/function_docstring b/.emacs.d/snippets/python-mode/function_docstring new file mode 100644 index 0000000..1f7f35b --- /dev/null +++ b/.emacs.d/snippets/python-mode/function_docstring @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: function_docstring +# key: fd +# group: definitions +# -- +def ${1:name}($2): + \"\"\"$3 + ${2:$(python-args-to-docstring)} + \"\"\" + $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/ife b/.emacs.d/snippets/python-mode/ife new file mode 100644 index 0000000..4b8f613 --- /dev/null +++ b/.emacs.d/snippets/python-mode/ife @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: ife +# key: ife +# group : control structure +# -- +if $1: + $2 +else: + $0 diff --git a/.emacs.d/snippets/python-mode/ifmain b/.emacs.d/snippets/python-mode/ifmain new file mode 100644 index 0000000..9575798 --- /dev/null +++ b/.emacs.d/snippets/python-mode/ifmain @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: ifmain +# key: ifm +# -- +if __name__ == '__main__': + ${1:main()} \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/import b/.emacs.d/snippets/python-mode/import new file mode 100644 index 0000000..f34bc39 --- /dev/null +++ b/.emacs.d/snippets/python-mode/import @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: import +# key: imp +# group : general +# -- +import ${1:lib}${2: as ${3:alias}} +$0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/init_docstring b/.emacs.d/snippets/python-mode/init_docstring new file mode 100644 index 0000000..51af8db --- /dev/null +++ b/.emacs.d/snippets/python-mode/init_docstring @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: init_docstring +# key: id +# group : definitions +# -- +def __init__(self$1): + \"\"\"$2 + ${1:$(python-args-to-docstring)} + \"\"\" + $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/lambda b/.emacs.d/snippets/python-mode/lambda new file mode 100644 index 0000000..08b268b --- /dev/null +++ b/.emacs.d/snippets/python-mode/lambda @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: lambda +# key: lam +# -- +lambda ${1:x}: $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/list b/.emacs.d/snippets/python-mode/list new file mode 100644 index 0000000..63cef24 --- /dev/null +++ b/.emacs.d/snippets/python-mode/list @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: list +# key: li +# group : definitions +# -- +[${1:el} for $1 in ${2:list}] +$0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/method b/.emacs.d/snippets/python-mode/method new file mode 100644 index 0000000..985ef0c --- /dev/null +++ b/.emacs.d/snippets/python-mode/method @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: method +# key: m +# group: object oriented +# -- +def ${1:method}(self${2:, $3}): + $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/method_docstring b/.emacs.d/snippets/python-mode/method_docstring new file mode 100644 index 0000000..8f5e78d --- /dev/null +++ b/.emacs.d/snippets/python-mode/method_docstring @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: method_docstring +# key: md +# group: object oriented +# -- +def ${1:name}(self$2): + \"\"\"$3 + ${2:$(python-args-to-docstring)} + \"\"\" + $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/not_impl b/.emacs.d/snippets/python-mode/not_impl new file mode 100644 index 0000000..515e353 --- /dev/null +++ b/.emacs.d/snippets/python-mode/not_impl @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: not_impl +# key: not_impl +# -- +raise NotImplementedError \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/parse_args b/.emacs.d/snippets/python-mode/parse_args new file mode 100644 index 0000000..aa61070 --- /dev/null +++ b/.emacs.d/snippets/python-mode/parse_args @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: parse_args +# key: pargs +# group: argparser +# -- +def parse_arguments(): + parser = argparse.ArgumentParser(description='$1') + $0 + return parser.parse_args() \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/parser b/.emacs.d/snippets/python-mode/parser new file mode 100644 index 0000000..29a04ea --- /dev/null +++ b/.emacs.d/snippets/python-mode/parser @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: parser +# key: pars +# group: argparser +# -- +parser = argparse.ArgumentParser(description='$1') +$0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/print b/.emacs.d/snippets/python-mode/print new file mode 100644 index 0000000..cc1c797 --- /dev/null +++ b/.emacs.d/snippets/python-mode/print @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: print +# key: p +# -- +print($0) \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/reg b/.emacs.d/snippets/python-mode/reg new file mode 100644 index 0000000..c4ebeac --- /dev/null +++ b/.emacs.d/snippets/python-mode/reg @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: reg +# key: reg +# group : general +# -- +${1:regexp} = re.compile(r"${2:expr}") +$0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/repr b/.emacs.d/snippets/python-mode/repr new file mode 100644 index 0000000..a1f6783 --- /dev/null +++ b/.emacs.d/snippets/python-mode/repr @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: __repr__ +# key: repr +# group: dunder methods +# -- +def __repr__(self): + $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/return b/.emacs.d/snippets/python-mode/return new file mode 100644 index 0000000..641a308 --- /dev/null +++ b/.emacs.d/snippets/python-mode/return @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: return +# key: r +# -- +return $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/script b/.emacs.d/snippets/python-mode/script new file mode 100644 index 0000000..e7f8a42 --- /dev/null +++ b/.emacs.d/snippets/python-mode/script @@ -0,0 +1,13 @@ +# -*- mode: snippet -*- +# name: script +# key: script +# -- +#!/usr/bin/env python +# -*- coding: utf-8 -*- + + +def main(): + pass + +if __name__ == '__main__': + main() diff --git a/.emacs.d/snippets/python-mode/self b/.emacs.d/snippets/python-mode/self new file mode 100644 index 0000000..4461022 --- /dev/null +++ b/.emacs.d/snippets/python-mode/self @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: self +# key: . +# group: object oriented +# -- +self.$0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/self_without_dot b/.emacs.d/snippets/python-mode/self_without_dot new file mode 100644 index 0000000..a1a0526 --- /dev/null +++ b/.emacs.d/snippets/python-mode/self_without_dot @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: self_without_dot +# key: s +# group: object oriented +# -- +self \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/selfassign b/.emacs.d/snippets/python-mode/selfassign new file mode 100644 index 0000000..95d7b2b --- /dev/null +++ b/.emacs.d/snippets/python-mode/selfassign @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: selfassign +# key: sn +# group: object oriented +# -- +self.$1 = $1 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/static b/.emacs.d/snippets/python-mode/static new file mode 100644 index 0000000..19c3df9 --- /dev/null +++ b/.emacs.d/snippets/python-mode/static @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: static +# key: sm +# -- +@staticmethod +def ${1:func}($0): diff --git a/.emacs.d/snippets/python-mode/str b/.emacs.d/snippets/python-mode/str new file mode 100644 index 0000000..b0572e3 --- /dev/null +++ b/.emacs.d/snippets/python-mode/str @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: __str__ +# key: str +# group: dunder methods +# -- +def __str__(self): + $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/try b/.emacs.d/snippets/python-mode/try new file mode 100644 index 0000000..8836de6 --- /dev/null +++ b/.emacs.d/snippets/python-mode/try @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: try +# key: try +# -- +try: + $1 +except ${2:Exception}: + $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/unicode b/.emacs.d/snippets/python-mode/unicode new file mode 100644 index 0000000..52d6b8d --- /dev/null +++ b/.emacs.d/snippets/python-mode/unicode @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: __unicode__ +# key: un +# group: dunder methods +# -- +def __unicode__(self): + $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/utf8 b/.emacs.d/snippets/python-mode/utf8 new file mode 100644 index 0000000..2ebd82e --- /dev/null +++ b/.emacs.d/snippets/python-mode/utf8 @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: utf-8 encoding +# key: utf8 +# -- +# -*- coding: utf-8 -*- diff --git a/.emacs.d/snippets/python-mode/while b/.emacs.d/snippets/python-mode/while new file mode 100644 index 0000000..7b3539c --- /dev/null +++ b/.emacs.d/snippets/python-mode/while @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: while +# key: wh +# group: control structure +# -- +while ${1:True}: + $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/with b/.emacs.d/snippets/python-mode/with new file mode 100644 index 0000000..7fcbd38 --- /dev/null +++ b/.emacs.d/snippets/python-mode/with @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: with +# key: with +# group : control structure +# -- +with ${1:expr}${2: as ${3:alias}}: + $0 \ No newline at end of file -- cgit v1.3