diff options
author | Tom Willemse | 2014-08-21 00:23:56 +0200 |
---|---|---|
committer | Tom Willemse | 2014-08-21 00:23:56 +0200 |
commit | c2778f0f713cc885087d6302196e421596ff248e (patch) | |
tree | f289c9e52bcaa6dd1ef7b64343df78492a36141d /emacs/.emacs.d/snippets | |
parent | 05415b9b2c455fb5e5f2521610b9d7dd33385d21 (diff) | |
download | dotfiles-c2778f0f713cc885087d6302196e421596ff248e.tar.gz dotfiles-c2778f0f713cc885087d6302196e421596ff248e.zip |
Add Emacs config
Diffstat (limited to 'emacs/.emacs.d/snippets')
24 files changed, 226 insertions, 0 deletions
diff --git a/emacs/.emacs.d/snippets/conf-mode/section b/emacs/.emacs.d/snippets/conf-mode/section new file mode 100644 index 0000000..55be8f8 --- /dev/null +++ b/emacs/.emacs.d/snippets/conf-mode/section @@ -0,0 +1,8 @@ +# -*- mode: snippet; require-final-newline: nil -*- +# name: Xorg Section +# key: Section +# -- +Section "$1" + Identifier "$2" + $0 +EndSection diff --git a/emacs/.emacs.d/snippets/emacs-lisp/face b/emacs/.emacs.d/snippets/emacs-lisp/face new file mode 100644 index 0000000..0a13b99 --- /dev/null +++ b/emacs/.emacs.d/snippets/emacs-lisp/face @@ -0,0 +1,5 @@ +# -*- mode: snippet; require-final-newline: nil -*- +# name: face +# key: f +# -- + `($1 ((t (${2::foreground} $0))))
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/html-mode/block b/emacs/.emacs.d/snippets/html-mode/block new file mode 100644 index 0000000..6510011 --- /dev/null +++ b/emacs/.emacs.d/snippets/html-mode/block @@ -0,0 +1,7 @@ +# -*- mode: snippet; require-final-newline: nil -*- +# name: block +# key: block +# -- +{% block $1 %} + $0 +{% endblock %}
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/html-mode/for b/emacs/.emacs.d/snippets/html-mode/for new file mode 100644 index 0000000..01d9c44 --- /dev/null +++ b/emacs/.emacs.d/snippets/html-mode/for @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: for +# key: for +# condition: pony-tpl-minor-mode +# -- +{% for $1 in $2 %} + $0 +{% endfor %}
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/html-mode/generic-block b/emacs/.emacs.d/snippets/html-mode/generic-block new file mode 100644 index 0000000..82d40c7 --- /dev/null +++ b/emacs/.emacs.d/snippets/html-mode/generic-block @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: Template Block +# key: % +# condition: pony-tpl-minor-mode +# -- +{% $1 %} + $0 +{% end$1 %}
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/html-mode/script b/emacs/.emacs.d/snippets/html-mode/script new file mode 100644 index 0000000..e50dbf5 --- /dev/null +++ b/emacs/.emacs.d/snippets/html-mode/script @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: script +# key: script +# -- +<script src="$1" type="${2:text/javascript}" language="${3:javascript}"></script>
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/html-mode/trans-with-cap b/emacs/.emacs.d/snippets/html-mode/trans-with-cap new file mode 100644 index 0000000..4f20a33 --- /dev/null +++ b/emacs/.emacs.d/snippets/html-mode/trans-with-cap @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: trans with cap +# key: trans +# condition: pony-tpl-minor-mode +# -- +{% trans "$1"|capfirst %}
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/org-mode/codeblock b/emacs/.emacs.d/snippets/org-mode/codeblock new file mode 100644 index 0000000..a200b08 --- /dev/null +++ b/emacs/.emacs.d/snippets/org-mode/codeblock @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: codeblock +# key: code +# -- +#+begin_src $1 + $0 +#+end_src
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/org-mode/heading b/emacs/.emacs.d/snippets/org-mode/heading new file mode 100644 index 0000000..9d5451e --- /dev/null +++ b/emacs/.emacs.d/snippets/org-mode/heading @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: Heading +# key: * +# -- +${1:*} ${2:TODO} $3 +${1:$(make-string (length text) ?\ )} :PROPERTIES: +${1:$(make-string (length text) ?\ )} :CATEGORY: $4 +${1:$(make-string (length text) ?\ )} :END: +${1:$(make-string (length text) ?\ )} $0
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/org-mode/project b/emacs/.emacs.d/snippets/org-mode/project new file mode 100644 index 0000000..269d655 --- /dev/null +++ b/emacs/.emacs.d/snippets/org-mode/project @@ -0,0 +1,51 @@ +# -*- mode: snippet -*- +# name: project +# key: project +# -- +#+TITLE: ${1:project_name} +#+LINK: src ${2:http://code.ryuslash.org/cgit.cgi/$3$1/} +#+LINK: tar_gz $2${4:snapshot/$1-master}.tar.gz +#+LINK: zip $2$4.zip +#+STARTUP: showall + +#+begin_html + <script src="/keyjs.js" type="text/javascript"></script> + <script type="text/javascript"> + keyjs_initialize({ "u": [ "keyjs_goto", "../index.html" ], + "h": [ "keyjs_goto", "http://ryuslash.org" ] }); + </script> +#+end_html + +#+INCLUDE: "dlmenu.inc" + +* About + + ${5:A short description about $1} + + | $0Status | $6 | + | Language | $7 | + | License | ${8:GPLv3} | + +* Why? + + ${9:Why did you even think of writing $1?} + +* Features + + ${10:$1 does...} + +* Dependencies + + ${11:$1 needs to have...} + +* Download + + ${12:To download $1...} + +* Install + + ${13:To install $1...} + +* Usage + + ${14:Using $1...}
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/org-mode/snippet b/emacs/.emacs.d/snippets/org-mode/snippet new file mode 100644 index 0000000..67f15d5 --- /dev/null +++ b/emacs/.emacs.d/snippets/org-mode/snippet @@ -0,0 +1,14 @@ +# -*- mode: snippet -*- +# name: snippet +# key: snippet +# -- +#+TITLE: ${1:snippet-name} +#+OPTIONS: toc:nil + +* $1 + + ${2:A short description abount $1} + + #+BEGIN_SRC $3 :tangle yes +$0 + #+END_SRC
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/php-mode/function b/emacs/.emacs.d/snippets/php-mode/function new file mode 100644 index 0000000..ab4cf2c --- /dev/null +++ b/emacs/.emacs.d/snippets/php-mode/function @@ -0,0 +1,8 @@ +# -*- mode: snippet; require-final-newline: nil -*- +# name: function +# key: function +# -- +function $1($2) +{ + $0 +}
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/php-mode/wpheader.php b/emacs/.emacs.d/snippets/php-mode/wpheader.php new file mode 100644 index 0000000..2c70f93 --- /dev/null +++ b/emacs/.emacs.d/snippets/php-mode/wpheader.php @@ -0,0 +1,13 @@ +# -*- mode: snippet; require-final-newline: nil -*- +# name: WP Plugin Header +# key: header +# -- +/* + * Plugin Name: $1 + * Plugin URI: $2 + * Description: $3 + * Version: ${4:1.0} + * Author: ${5:Tom Willemse} + * Author URI: ${6:https://ryuslash.org} + * License: ${7:GPLv2} + */
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/python-mode/defm_empty b/emacs/.emacs.d/snippets/python-mode/defm_empty new file mode 100644 index 0000000..baa976e --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/defm_empty @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# name: Empty Defmethod +# key: defm +# -- +def ${1:name}(self, *args, **kwargs): + '''$2''' + return super(${3:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).$1(*args, **kwargs)
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/python-mode/form b/emacs/.emacs.d/snippets/python-mode/form new file mode 100644 index 0000000..225d5e4 --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/form @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: Model Form +# key: form +# -- +class ${1:Model}Form(forms.ModelForm): + '''Form for the $1 model.''' + + class Meta: + model = $1
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/python-mode/form_valid b/emacs/.emacs.d/snippets/python-mode/form_valid new file mode 100644 index 0000000..c5a7e58 --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/form_valid @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: Record form +# key: defm +# -- +@record_activity(model=${1:`(progn (re-search-backward "^[ \t]*model = \\([a-zA-Z_].*\\)$") (match-string 1))`}) +def form_valid(self, form): + '''Make sure any changes to the $1 model get logged.''' + return super(${2:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).form_valid(form)
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/python-mode/form_valid_with_return b/emacs/.emacs.d/snippets/python-mode/form_valid_with_return new file mode 100644 index 0000000..fac23bc --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/form_valid_with_return @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: form_valid with return +# key: formvalid +# -- +def form_valid(self, form): + rv = super(`(let ((name (python-info-current-defun))) (substring name 0 (cl-position ?. name)))`, self).form_valid(form) + $0 + return rv
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/python-mode/import_from b/emacs/.emacs.d/snippets/python-mode/import_from new file mode 100644 index 0000000..d9cc4e2 --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/import_from @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# name: from ... import ... +# contributor: Tom Willemse +# key: from +# -- +from ${1:module} import ${2:class_or_module} diff --git a/emacs/.emacs.d/snippets/python-mode/method b/emacs/.emacs.d/snippets/python-mode/method new file mode 100644 index 0000000..7c033cf --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/method @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: method +# key: defm +# -- +def $1(self$2): + '''$3''' + $0
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/python-mode/permission_guard b/emacs/.emacs.d/snippets/python-mode/permission_guard new file mode 100644 index 0000000..ab53895 --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/permission_guard @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: Permission guard +# key: defm +# -- +@method_decorator(permission_required('$1', + raise_exception=True)) +def dispatch(self, *args, **kwargs): + '''Make sure the user has the $1 permission.''' + return super(${3:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).dispatch(*args, **kwargs)
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/python-mode/url b/emacs/.emacs.d/snippets/python-mode/url new file mode 100644 index 0000000..00ade72 --- /dev/null +++ b/emacs/.emacs.d/snippets/python-mode/url @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: url +# key: url +# -- +url(r'^$1', $2, name='$3'),
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/ruby-mode/ProductSeed b/emacs/.emacs.d/snippets/ruby-mode/ProductSeed new file mode 100644 index 0000000..7e836c2 --- /dev/null +++ b/emacs/.emacs.d/snippets/ruby-mode/ProductSeed @@ -0,0 +1,5 @@ +# -*- mode: snippet; require-final-newline: nil -*- +# name: ProductSeed +# key: pseed +# -- +Product.find_or_create_by_name(parent_id: $1, name: '$2', description: '$3', price: '$4')
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/ruby-mode/ProductSeedHW b/emacs/.emacs.d/snippets/ruby-mode/ProductSeedHW new file mode 100644 index 0000000..843b32e --- /dev/null +++ b/emacs/.emacs.d/snippets/ruby-mode/ProductSeedHW @@ -0,0 +1,5 @@ +# -*- mode: snippet; require-final-newline: nil -*- +# name: ProductSeedWithHW +# key: pseed +# -- +Product.find_or_create_by_name(parent_id: $1, name: '$2', description: '$3', price: '$4', width_in_cm: '$5', height_in_cm: '$6', width_in_mm: '${5:$(round (* 10 (string-to-int yas-text)))}', height_in_mm: '${6:$(round (* 10 (string-to-int yas-text)))}')
\ No newline at end of file diff --git a/emacs/.emacs.d/snippets/ruby-mode/ProductSeedHWGroup b/emacs/.emacs.d/snippets/ruby-mode/ProductSeedHWGroup new file mode 100644 index 0000000..25594c5 --- /dev/null +++ b/emacs/.emacs.d/snippets/ruby-mode/ProductSeedHWGroup @@ -0,0 +1,8 @@ +# -*- mode: snippet; require-final-newline: nil -*- +# name: ProductSeedWithHWGroup +# key: pseed +# -- +Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Small', price: '20.00', width_in_cm: '25.00', height_in_cm: '21.00', width_in_mm: '250', height_in_mm: '210') +Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Medium', price: '20.00', width_in_cm: '30.00', height_in_cm: '25.80', width_in_mm: '300', height_in_mm: '258') +Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Large', price: '20.00', width_in_cm: '35.00', height_in_cm: '30.00', width_in_mm: '350', height_in_mm: '300') +Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Extra large', price: '20.00', width_in_cm: '40.00', height_in_cm: '34.00', width_in_mm: '400', height_in_mm: '340') |