diff --git a/dotfiles/emacs.d/snippets/org-mode/.yas-ignore-filenames-as-triggers b/dotfiles/emacs.d/snippets/org-mode/.yas-ignore-filenames-as-triggers new file mode 100644 index 00000000..e69de29b diff --git a/dotfiles/emacs.d/snippets/org-mode/.yas-make-groups b/dotfiles/emacs.d/snippets/org-mode/.yas-make-groups new file mode 100644 index 00000000..e69de29b diff --git a/dotfiles/emacs.d/snippets/org-mode/.yas-parents b/dotfiles/emacs.d/snippets/org-mode/.yas-parents new file mode 100644 index 00000000..eed5b442 --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/.yas-parents @@ -0,0 +1 @@ +text-mode diff --git a/dotfiles/emacs.d/snippets/org-mode/README.org b/dotfiles/emacs.d/snippets/org-mode/README.org new file mode 100644 index 00000000..7cf584a9 --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/attr_html.yasnippet b/dotfiles/emacs.d/snippets/org-mode/attr_html.yasnippet new file mode 100644 index 00000000..1feda6af --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/attr_latex.yasnippet b/dotfiles/emacs.d/snippets/org-mode/attr_latex.yasnippet new file mode 100644 index 00000000..15768a7c --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/author.yasnippet b/dotfiles/emacs.d/snippets/org-mode/author.yasnippet new file mode 100644 index 00000000..359b9fe0 --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/block.yasnippet b/dotfiles/emacs.d/snippets/org-mode/block.yasnippet new file mode 100644 index 00000000..5e889180 --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/corollary.yasnippet b/dotfiles/emacs.d/snippets/org-mode/corollary.yasnippet new file mode 100644 index 00000000..8f267503 --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/definition.yasnippet b/dotfiles/emacs.d/snippets/org-mode/definition.yasnippet new file mode 100644 index 00000000..634e5d53 --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/ditaa.yasnippet b/dotfiles/emacs.d/snippets/org-mode/ditaa.yasnippet new file mode 100644 index 00000000..7d395ed3 --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/el.yasnippet b/dotfiles/emacs.d/snippets/org-mode/el.yasnippet new file mode 100644 index 00000000..cd4cc3d7 --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/email.yasnippet b/dotfiles/emacs.d/snippets/org-mode/email.yasnippet new file mode 100644 index 00000000..a75cc984 --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/equation.yasnippet b/dotfiles/emacs.d/snippets/org-mode/equation.yasnippet new file mode 100644 index 00000000..1f1732d3 --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/figure.yasnippet b/dotfiles/emacs.d/snippets/org-mode/figure.yasnippet new file mode 100644 index 00000000..bed45b4a --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/install.sh b/dotfiles/emacs.d/snippets/org-mode/install.sh new file mode 100755 index 00000000..bec9dfb7 --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/language.yasnippet b/dotfiles/emacs.d/snippets/org-mode/language.yasnippet new file mode 100644 index 00000000..6534a36c --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/latexclass.yasnippet b/dotfiles/emacs.d/snippets/org-mode/latexclass.yasnippet new file mode 100644 index 00000000..60d7bc0a --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/latexheader.yasnippet b/dotfiles/emacs.d/snippets/org-mode/latexheader.yasnippet new file mode 100644 index 00000000..2afe3cfd --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/lemma.yasnippet b/dotfiles/emacs.d/snippets/org-mode/lemma.yasnippet new file mode 100644 index 00000000..a4ab9da3 --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/options.yasnippet b/dotfiles/emacs.d/snippets/org-mode/options.yasnippet new file mode 100644 index 00000000..f4f9f76b --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/proof.yasnippet b/dotfiles/emacs.d/snippets/org-mode/proof.yasnippet new file mode 100644 index 00000000..0ce57abf --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/propertiesfolded.yasnippet b/dotfiles/emacs.d/snippets/org-mode/propertiesfolded.yasnippet new file mode 100644 index 00000000..fcec3c50 --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/proposition.yasnippet b/dotfiles/emacs.d/snippets/org-mode/proposition.yasnippet new file mode 100644 index 00000000..6ab20961 --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/sourceblock.yasnippet b/dotfiles/emacs.d/snippets/org-mode/sourceblock.yasnippet new file mode 100644 index 00000000..9637f0bd --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/startup.yasnippet b/dotfiles/emacs.d/snippets/org-mode/startup.yasnippet new file mode 100644 index 00000000..235c2bab --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/text.yasnippet b/dotfiles/emacs.d/snippets/org-mode/text.yasnippet new file mode 100644 index 00000000..5c7a37a2 --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/theorem.yasnippet b/dotfiles/emacs.d/snippets/org-mode/theorem.yasnippet new file mode 100644 index 00000000..f98af773 --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/tikz-figure.yasnippet b/dotfiles/emacs.d/snippets/org-mode/tikz-figure.yasnippet new file mode 100644 index 00000000..07aef9d8 --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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/dotfiles/emacs.d/snippets/org-mode/title.yasnippet b/dotfiles/emacs.d/snippets/org-mode/title.yasnippet new file mode 100644 index 00000000..b4b59d1a --- /dev/null +++ b/dotfiles/emacs.d/snippets/org-mode/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