Merge commit '6398be78bc248f3767b8734f28c77018a34d77ff' as 'dotfiles/emacs.d/snippets/org-mode'

This commit is contained in:
Ivan Malison 2015-07-29 17:26:01 -07:00
commit 1c008cb16e
30 changed files with 305 additions and 0 deletions

View File

@ -0,0 +1 @@
text-mode

View File

@ -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:~ |

View File

@ -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"

View File

@ -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}

View File

@ -0,0 +1,8 @@
# name: author
# key: aut
# binding: C-c y a
# condition: (or (= (current-column) 3) (= (current-column) 0))
# contributor : Rick Moynihan <rick@sourcesmouth.co.uk>
# contributor: Rafael Villarroel (rvf0068@gmail.com)
# --
#+AUTHOR: ${1:`user-full-name`}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,9 @@
# name: ditaa
# key: dit
# condition: (or (= (current-column) 3) (= (current-column) 0))
# contributor: Rick Moynihan <rick@sourcesmouth.co.uk>
# contributor: Rafael Villarroel (rvf0068@gmail.com)
# --
#+BEGIN_SRC ditaa ${1:export-file-name} -r -s -e
${0}
#+END_SRC

View File

@ -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

View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: email
# key: email
# condition: (or (= (current-column) 5) (= (current-column) 0))
# contributor: Rick Moynihan <rick@sourcesmouth.co.uk>
# contributor: Rafael Villarroel (rvf0068@gmail.com)
# --
#+EMAIL: ${1:`user-mail-address`}

View File

@ -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}

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: language
# key: lan
# condition: (= (current-column) 3)
# contributor: Rick Moynihan <rick@sourcesmouth.co.uk>
# contributor: Rafael Villarroel (rvf0068@gmail.com)
# --
#+LANGUAGE: ${1:$$(yas/choose-value '("en" "es"))}

View File

@ -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"))}

View File

@ -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}}

View File

@ -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

View File

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: options
# contributor : Rick Moynihan <rick@sourcesmouth.co.uk>
# contributor: Rafael Villarroel (rvf0068@gmail.com)
# binding: C-c y o
# condition: (or (= (current-column) 3) (= (current-column) 0))
# key: opt
# --
#+OPTIONS: ${0}

View File

@ -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

View File

@ -0,0 +1,9 @@
# name: properties folded
# contributor: Jonathan Arkell <jonnay@jonnay.net>
# contributor: Rafael Villarroel (rvf0068@gmail.com)
# condition: (= (current-column) 10)
# key: properties
# --
:PROPERTIES:
:VISIBILITY:folded:
:END:

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: startup
# contributor : Rick Moynihan <rick@sourcesmouth.co.uk>
# contributor: Rafael Villarroel (rvf0068@gmail.com)
# condition: (or (= (current-column) 3) (= (current-column) 0))
# key: sta
# --
#+STARTUP: ${1:options}

View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: text
# contributor: Rick Moynihan <rick@sourcesmouth.co.uk>
# contributor: Rafael Villarroel (rvf0068@gmail.com)
# condition: (or (= (current-column) 4) (= (current-column) 0))
# key: text
# --
#+TEXT: ${1:text}

View File

@ -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

View File

@ -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 <rvf0068@gmail.com>
# 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

View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: title
# contributor : Rick Moynihan <rick@sourcesmouth.co.uk>
# contributor: Rafael Villarroel (rvf0068@gmail.com)
# condition: (= (current-column) 5)
# key: title
# --
#+TITLE: ${1:title}