commit a3cd73bbea10560b3087bbdf04eb170828b30e70 Author: Ivan Malison Date: Wed Jul 29 17:26:01 2015 -0700 Squashed 'dotfiles/emacs.d/snippets/org-mode/' content from commit 63d0bbd git-subtree-dir: dotfiles/emacs.d/snippets/org-mode git-subtree-split: 63d0bbd9629b3a07a56c61dded5502484ee53d1a diff --git a/.yas-ignore-filenames-as-triggers b/.yas-ignore-filenames-as-triggers new file mode 100644 index 00000000..e69de29b diff --git a/.yas-make-groups b/.yas-make-groups new file mode 100644 index 00000000..e69de29b diff --git a/.yas-parents b/.yas-parents new file mode 100644 index 00000000..eed5b442 --- /dev/null +++ b/.yas-parents @@ -0,0 +1 @@ +text-mode diff --git a/README.org b/README.org new file mode 100644 index 00000000..7cf584a9 --- /dev/null +++ b/README.org @@ -0,0 +1,41 @@ +#+title: yasnippets +#+options: ^:nil + +Snippets for org-mode. See [[https://github.com/capitaomorte/yasnippet][Yasnippet in Github]]. + +They have bindings ~C-c y~ plus an extra letter. + +I have added a ~condition~ statement so that the snippets can be +expanded only at the beginning of the line. + +| name | key | letter | explanation | +|-------------------------------------+------------+--------+--------------------------------------| +| #+begin_ ...#+end_ | block | b | | +| #+srcname:..#+begin_src...#+end_src | sb | s | source block with name | +| attr_html | ath | | alt="$1" img class="aligncenter" | +| attr_latex | atl | | ${1:width=$2\textwidth} | +| author | aut | a | inserts ~#+author:~ | +| corollary | cor | c | (uses reftex) | +| definition | def | d | (uses reftex) | +| ditaa | dit | | #+begin_ditaa,+end_ditaa | +| el | el | | #+begin_src emacs-lisp,+end_src | +| email | email | | inserts ~#+email:~ | +| equation | eqn | e | (uses reftex) | +| figure | fig | f | asks for image file | +| language | lan | | inserts ~#+language:~ (with choice) | +| LaTeX class | lcl | | inserts ~#+latex_class:~ (with choice) | +| LaTeX header | lhe | | inserts ~#+latex_header:~ | +| lemma | lem | l | (uses reftex) | +| options | opt | o | inserts ~#+options:~ | +| proof | prf | | | +| properties folded | properties | | inserts visibility folded property | +| proposition | pro | p | (uses reftex) | +| startup | sta | | inserts ~#+startup:~ | +| text | text | | inserts ~#+text:~ | +| theorem | thm | t | (uses reftex) | +| tikz-picture | tkz | z | (uses reftex) | +| title | title | | inserts ~#+title:~ | + + + + diff --git a/attr_html.yasnippet b/attr_html.yasnippet new file mode 100644 index 00000000..1feda6af --- /dev/null +++ b/attr_html.yasnippet @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name : attr_html +# key: ath +# condition: (= (current-column) 3) +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# -- +#+ATTR_HTML: alt="$1" img class="aligncenter" diff --git a/attr_latex.yasnippet b/attr_latex.yasnippet new file mode 100644 index 00000000..15768a7c --- /dev/null +++ b/attr_latex.yasnippet @@ -0,0 +1,6 @@ +# name: attr_latex +# key: atl +# condition: (= (current-column) 3) +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# -- +#+attr_latex: ${1:width=$2\textwidth} diff --git a/author.yasnippet b/author.yasnippet new file mode 100644 index 00000000..359b9fe0 --- /dev/null +++ b/author.yasnippet @@ -0,0 +1,8 @@ +# name: author +# key: aut +# binding: C-c y a +# condition: (or (= (current-column) 3) (= (current-column) 0)) +# contributor : Rick Moynihan +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# -- +#+AUTHOR: ${1:`user-full-name`} diff --git a/block.yasnippet b/block.yasnippet new file mode 100644 index 00000000..5e889180 --- /dev/null +++ b/block.yasnippet @@ -0,0 +1,9 @@ +# name : #+begin_...#+end_ +# expand-env: ((yas/indent-line 'fixed) (yas/wrap-around-region 'nil)) +# condition: (or (= (current-column) 5) (= (current-column) 0)) +# key: block +# binding: C-c y b +# -- +#+BEGIN_$1 $2 + $0 +#+END_$1 diff --git a/corollary.yasnippet b/corollary.yasnippet new file mode 100644 index 00000000..8f267503 --- /dev/null +++ b/corollary.yasnippet @@ -0,0 +1,12 @@ +# -*- mode: snippet -*- +# name: corollary +# key: cor +# binding: C-c y c +# condition: (or (= (current-column) 3) (= (current-column) 0)) +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# -- +# <<$1>> +#+BEGIN_COROLLARY +#+latex: \label{${1:"waiting"$(unless yas/modified-p (reftex-label "corollary" 'dont-insert))}}% +$0 +#+END_COROLLARY \ No newline at end of file diff --git a/definition.yasnippet b/definition.yasnippet new file mode 100644 index 00000000..634e5d53 --- /dev/null +++ b/definition.yasnippet @@ -0,0 +1,12 @@ +# -*- mode: snippet -*- +# name: definition +# key: def +# binding: C-c y d +# condition: (or (= (current-column) 3) (= (current-column) 0)) +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# -- +# <<$1>> +#+BEGIN_DEFINITION +#+LATEX: \label{${1:"waiting"$(unless yas/modified-p (reftex-label "definition" 'dont-insert))}}% +$0 +#+END_DEFINITION \ No newline at end of file diff --git a/ditaa.yasnippet b/ditaa.yasnippet new file mode 100644 index 00000000..7d395ed3 --- /dev/null +++ b/ditaa.yasnippet @@ -0,0 +1,9 @@ +# name: ditaa +# key: dit +# condition: (or (= (current-column) 3) (= (current-column) 0)) +# contributor: Rick Moynihan +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# -- +#+BEGIN_SRC ditaa ${1:export-file-name} -r -s -e +${0} +#+END_SRC diff --git a/el.yasnippet b/el.yasnippet new file mode 100644 index 00000000..cd4cc3d7 --- /dev/null +++ b/el.yasnippet @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: el (emacs-lisp) +# key: el +# condition: (= (current-column) 2) +# -- +#+NAME: $1 +#+BEGIN_SRC emacs-lisp +$0 +#+END_SRC \ No newline at end of file diff --git a/email.yasnippet b/email.yasnippet new file mode 100644 index 00000000..a75cc984 --- /dev/null +++ b/email.yasnippet @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: email +# key: email +# condition: (or (= (current-column) 5) (= (current-column) 0)) +# contributor: Rick Moynihan +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# -- +#+EMAIL: ${1:`user-mail-address`} diff --git a/equation.yasnippet b/equation.yasnippet new file mode 100644 index 00000000..1f1732d3 --- /dev/null +++ b/equation.yasnippet @@ -0,0 +1,12 @@ +# -*- mode: snippet -*- +# name: equation +# key: eqn +# binding: C-c y e +# condition: (or (= (current-column) 3) (= (current-column) 0)) +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# -- +# <<$1>> +\begin{equation} +\label{${1:"waiting for reftex-label call..."$(unless yas/modified-p (reftex-label nil 'dont-insert))}}% +$0 +\end{equation} diff --git a/figure.yasnippet b/figure.yasnippet new file mode 100644 index 00000000..bed45b4a --- /dev/null +++ b/figure.yasnippet @@ -0,0 +1,12 @@ +# -*- mode: snippet -*- +# name: figure +# key: fig +# binding: C-c y f +# condition: (or (= (current-column) 3) (= (current-column) 0)) +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# -- +#+attr_latex: width=$1\textwidth +#+ATTR_HTML: width="$2%" +#+caption: $3 +`(org-insert-link '(4))` +$0 diff --git a/install.sh b/install.sh new file mode 100755 index 00000000..bec9dfb7 --- /dev/null +++ b/install.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Check for command line args. +if [ "$1" = "" ]; then + echo "Usage: ./install.sh yasnippet-dir" + echo "Example: ./install.sh ~/.emacs.d/plugins/yasnippet" + echo "This makes a \"snippets/org-mode\" folder and installs there" + exit 1 +fi + +# Create the latex-mode dir. +if [ ! -d "$1"/snippets/org-mode ]; then + mkdir "$1"/snippets/org-mode +fi + +# Copy needed files to the latex-mode dir. +cp *.yasnippet "$1"/snippets/org-mode/ +cp .yas-parents "$1"/snippets/org-mode/ +cp .yas-ignore-filenames-as-triggers "$1"/snippets/org-mode/ +cp .yas-make-groups "$1"/snippets/org-mode/ + +exit 0 diff --git a/language.yasnippet b/language.yasnippet new file mode 100644 index 00000000..6534a36c --- /dev/null +++ b/language.yasnippet @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: language +# key: lan +# condition: (= (current-column) 3) +# contributor: Rick Moynihan +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# -- +#+LANGUAGE: ${1:$$(yas/choose-value '("en" "es"))} diff --git a/latexclass.yasnippet b/latexclass.yasnippet new file mode 100644 index 00000000..60d7bc0a --- /dev/null +++ b/latexclass.yasnippet @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: LaTeX class +# key: lcl +# condition: (= (current-column) 3) +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# -- +#+LATEX_CLASS: ${1:$$(yas/choose-value '("report" "book" "article"))} diff --git a/latexheader.yasnippet b/latexheader.yasnippet new file mode 100644 index 00000000..2afe3cfd --- /dev/null +++ b/latexheader.yasnippet @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: LaTeX header +# key: lhe +# condition: (= (current-column) 3) +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# -- +#+LATEX_HEADER: ${1:\usepackage{$2}} diff --git a/lemma.yasnippet b/lemma.yasnippet new file mode 100644 index 00000000..a4ab9da3 --- /dev/null +++ b/lemma.yasnippet @@ -0,0 +1,12 @@ +# -*- mode: snippet -*- +# name: lemma +# key: lem +# binding: C-c y l +# condition: (or (= (current-column) 3) (= (current-column) 0)) +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# -- +# <<$1>> +#+BEGIN_LEMMA +#+LATEX: \label{${1:"waiting"$(unless yas/modified-p (reftex-label "lemma" 'dont-insert))}}% +$0 +#+END_LEMMA \ No newline at end of file diff --git a/options.yasnippet b/options.yasnippet new file mode 100644 index 00000000..f4f9f76b --- /dev/null +++ b/options.yasnippet @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: options +# contributor : Rick Moynihan +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# binding: C-c y o +# condition: (or (= (current-column) 3) (= (current-column) 0)) +# key: opt +# -- +#+OPTIONS: ${0} \ No newline at end of file diff --git a/proof.yasnippet b/proof.yasnippet new file mode 100644 index 00000000..0ce57abf --- /dev/null +++ b/proof.yasnippet @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: proof +# key: prf +# condition: (or (= (current-column) 3) (= (current-column) 0)) +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# -- +#+BEGIN_PROOF +$0 +#+END_PROOF \ No newline at end of file diff --git a/propertiesfolded.yasnippet b/propertiesfolded.yasnippet new file mode 100644 index 00000000..fcec3c50 --- /dev/null +++ b/propertiesfolded.yasnippet @@ -0,0 +1,9 @@ +# name: properties folded +# contributor: Jonathan Arkell +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# condition: (= (current-column) 10) +# key: properties +# -- + :PROPERTIES: + :VISIBILITY:folded: + :END: diff --git a/proposition.yasnippet b/proposition.yasnippet new file mode 100644 index 00000000..6ab20961 --- /dev/null +++ b/proposition.yasnippet @@ -0,0 +1,11 @@ +# name: proposition +# key: pro +# binding: C-c y p +# condition: (or (= (current-column) 3) (= (current-column) 0)) +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# -- +# <<$1>> +#+BEGIN_PROPOSITION +#+latex: \label{${1:"waiting"$(unless yas/modified-p (reftex-label "proposition" 'dont-insert))}}% +$0 +#+END_PROPOSITION \ No newline at end of file diff --git a/sourceblock.yasnippet b/sourceblock.yasnippet new file mode 100644 index 00000000..9637f0bd --- /dev/null +++ b/sourceblock.yasnippet @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name : #+srcname:..#+begin_src...#+end_src +# key: sb +# binding: C-c y s +# condition: (or (= (current-column) 2) (= (current-column) 0)) +# -- +#+NAME: ${1:name} +#+BEGIN_SRC ${2:language} + $3 +#+END_SRC diff --git a/startup.yasnippet b/startup.yasnippet new file mode 100644 index 00000000..235c2bab --- /dev/null +++ b/startup.yasnippet @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: startup +# contributor : Rick Moynihan +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# condition: (or (= (current-column) 3) (= (current-column) 0)) +# key: sta +# -- +#+STARTUP: ${1:options} \ No newline at end of file diff --git a/text.yasnippet b/text.yasnippet new file mode 100644 index 00000000..5c7a37a2 --- /dev/null +++ b/text.yasnippet @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: text +# contributor: Rick Moynihan +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# condition: (or (= (current-column) 4) (= (current-column) 0)) +# key: text +# -- +#+TEXT: ${1:text} \ No newline at end of file diff --git a/theorem.yasnippet b/theorem.yasnippet new file mode 100644 index 00000000..f98af773 --- /dev/null +++ b/theorem.yasnippet @@ -0,0 +1,12 @@ +# -*- mode: snippet -*- +# name: theorem +# key: thm +# binding: C-c y t +# condition: (or (= (current-column) 3) (= (current-column) 0)) +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# -- +# <<$1>> +#+BEGIN_THEOREM +#+latex: \label{${1:"waiting"$(unless yas/modified-p (reftex-label "theorem" 'dont-insert))}}% +$0 +#+END_THEOREM \ No newline at end of file diff --git a/tikz-figure.yasnippet b/tikz-figure.yasnippet new file mode 100644 index 00000000..07aef9d8 --- /dev/null +++ b/tikz-figure.yasnippet @@ -0,0 +1,19 @@ +# -*- mode: snippet -*- +# name: tikz-figure +# binding: C-c y z +# condition: (or (= (current-column) 3) (= (current-column) 0)) +# contributor: Rafael Villarroel +# key: tkz +# -- +#+CAPTION: $1 +#+LABEL: ${2:"waiting"$(unless yas/modified-p (reftex-label "figure" 'dont-insert))} +#+ATTR_HTML: alt="$1" width="$3%" +#+ATTR_LATEX: width=0.$3\textwidth +#+ATTR_ODT: (:scale 0.$3) +#+HEADERS: :imagemagick yes :iminoptions -density 300 -resize 400 +#+HEADERS: :packages '(("" "tikz") ("" "tkz-berge")) :border 1pt +#+BEGIN_SRC latex :file ${2:$(substring yas/text 4)}.png + \begin{tikzpicture} + ${0} + \end{tikzpicture} +#+END_SRC diff --git a/title.yasnippet b/title.yasnippet new file mode 100644 index 00000000..b4b59d1a --- /dev/null +++ b/title.yasnippet @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: title +# contributor : Rick Moynihan +# contributor: Rafael Villarroel (rvf0068@gmail.com) +# condition: (= (current-column) 5) +# key: title +# -- +#+TITLE: ${1:title} \ No newline at end of file