commit 2d95f5c7bd5efaa22c915cd3b28aa05438b1d1c7
parent ace4a3461c3a8af803c3b0df27cca0c4f426c8b0
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Sun, 5 Apr 2020 21:20:26 +0200
vim: snippets
Former-commit-id: c4eec15866cfce19c1bc4b4b252a6c37516d9694
Diffstat:
6 files changed, 230 insertions(+), 49 deletions(-)
diff --git a/vim/ultisnips/all.snippets b/vim/ultisnips/all.snippets
@@ -1,26 +0,0 @@
-snippet skel "A launchd job template" b
-<!-- Documentation here: https://www.launchd.info/ -->
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
- <dict>
- <key>Label</key>
- <string>${1:com.example.app}</string>
- <key>Program</key>
- <string>${2:/path/to/script}</string>
- <!--
- <key>ProgramArguments</key>
- <array>
- <string></string>
- <string></string>
- </array>
- -->
- <key>RunAtLoad</key>
- <${3:true if run on boot/login}/>
- <key>StartInterval</key>
- <integer>${4:interval in which to run in seconds; then keepalive should be false}</integer>
- <key>KeepAlive</key>
- <${5:true if the job should always be running, or e.g. dict with SuccessfulExit}/>
- </dict>
-</plist>
-endsnippet
diff --git a/vim/ultisnips/bib.snippets b/vim/ultisnips/bib.snippets
@@ -0,0 +1,56 @@
+snippet @book "Book citation" b
+@book{${1:ref},
+ author = "",
+ title = "",
+ publisher = "",
+ ?_volume = "",
+ ?_number = "",
+ ?_series = "",
+ ?_address = "",
+ ?_edition = "",
+ year = "",
+ ?_month = "",
+ ?_note = ""
+}
+endsnippet
+snippet @article "Article" b
+@article{${1:ref},
+ author = "",
+ title = "",
+ journal = "",
+ ?_volume = "",
+ ?_number = "",
+ ?_pages = "",
+ year = "",
+ ?_month = "",
+ ?_note = ""
+}
+endsnippet
+snippet @proceedings "Proceedings from conference" b
+@inproceedings{${1:ref},
+ author = "",
+ title = "",
+ booktitle = "",
+ ?_editor = "",
+ ?_volume = "",
+ ?_number = "",
+ ?_series = "",
+ ?_pages = "",
+ ?_address = "",
+ ?_organization = "",
+ ?_publisher = "",
+ year = "",
+ ?_month = "",
+ ?_note = ""
+}
+endsnippet
+snippet @misc "Misc (website, etc.)" b
+@misc{${1:ref},
+ ?_author = "",
+ ?_title = "",
+ ?_howpublished = "",
+ ?_year = "XXXX",
+ ?_month = "",
+ ?_note = ""
+}
+endsnippet
diff --git a/vim/ultisnips/markdown.snippets b/vim/ultisnips/markdown.snippets
@@ -37,3 +37,27 @@ $1
$0
endsnippet
+
+snippet format "Pandoc format" b
+---
+fontsize: 10pt
+pagestyle: empty
+bibliography: references.bib
+citation-style: https://raw.githubusercontent.com/citation-style-language/styles/master/ieee.csl
+link-citations: true
+geometry:
+- a4paper
+- left=1in
+- right=1in
+- top=1in
+- bottom=1in
+# For image placement
+header-includes:
+ \usepackage{float}
+ \floatplacement{figure}{H}
+---
+
+# References
+::: {#refs}
+:::
+endsnippet
diff --git a/vim/ultisnips/sshconfig.snippets b/vim/ultisnips/sshconfig.snippets
@@ -0,0 +1,12 @@
+snippet skel "Skeleton with everything I might need" b
+Host ${1:user-friendly name}
+ HostName ${2:actual IP address}
+ User ${3:username}
+ Port ${4:22}
+ IdentityFile ${5:/path/to/key}
+ IdentitiesOnly ${6:yes}
+ AddKeysToAgent ${7:yes}
+ ForwardX11 ${8:yes}
+ ProxyJump ${9:other host}
+ SendEnv ${10:ENV_VARIABLE_TO_SEND}
+endsnippet
diff --git a/vim/ultisnips/tex.snippets b/vim/ultisnips/tex.snippets
@@ -13,20 +13,20 @@ texIgnoreMathZoneIds = vim.eval('map('+str(texIgnoreMathZones)+", 'hlID(v:val)')
ignore = texIgnoreMathZoneIds[0]
def math():
- synstackids = vim.eval("synstack(line('.'), col('.') - (col('.')>=2 ? 1 : 0))")
- try:
- first = next(
+ synstackids = vim.eval("synstack(line('.'), col('.') - (col('.')>=2 ? 1 : 0))")
+ try:
+ first = next(
i for i in reversed(synstackids)
if i in texIgnoreMathZoneIds or i in texMathZoneIds
)
- return first != ignore
- except StopIteration:
- return False
+ return first != ignore
+ except StopIteration:
+ return False
endglobal
# }}}
# Skeletons {{{
-snippet skel "Math skeleton" b
+snippet skel "Assignment skeleton" b
\documentclass[12pt,a4paper,oneside,fleqn,notitlepage]{article}
\usepackage{amsmath}
\usepackage{amssymb}
@@ -48,6 +48,53 @@ snippet skel "Math skeleton" b
\end{document}
endsnippet
+snippet skel "Academic paper" b
+\documentclass[10pt,notitlepage]{article}
+\usepackage[a4paper, top=0.6in, left=0.6in, right=0.6in, bottom=0.6in]{geometry}
+\usepackage[utf8]{inputenc}
+\usepackage[english]{babel}
+\usepackage{hyperref}
+\usepackage{csquotes}
+\usepackage[style=ieee]{biblatex}
+\usepackage{amsmath}
+\usepackage{amssymb}
+\usepackage{graphicx}
+\usepackage{caption}
+\usepackage{subcaption}
+
+\graphicspath{{${1:image directory}}}
+\addbibresource{references.bib}
+
+\title{
+ {${2:title}}\\
+ {\large ${3:institution}}
+}
+\author{
+ ${4:author}
+ \and ${5:second author}
+}
+\date{\today}
+
+\begin{document}
+ \maketitle
+
+ \begin{abstract}
+ This is an abstract.
+ \end{abstract}
+
+ \input{introduction}
+ \input{background}
+ \input{method}
+ \input{results}
+ \input{discussion}
+ \input{conclusion}
+
+ \printbibliography
+
+ \input{appendix}
+\end{document}
+endsnippet
+
snippet front "Front matter" b
\title{$1}
\author{$2}
@@ -111,16 +158,58 @@ $1
endsnippet
snippet table "Table" w
-\vspace{1em}
-\renewcommand{\arraystretch}{1.5}
-\begin{tabular}{| l | c | r |}
- \hline
- \textbf{${1:heading}} & \textbf{${2:heading}} & \textbf{${3:heading}} \\\\ \hline
- ${4:cell} & ${5:cell} & ${6:cell} \\\\ \hline
- $0 \\\\ \hline
-\end{tabular}
-\renewcommand{\arraystretch}{1}
-\vspace{1em}
+\begin{table}[h]
+ \centering
+ \vspace{1em}
+ \renewcommand{\arraystretch}{1.5}
+ \begin{tabular}{| l | c | r |}
+ \hline
+ \textbf{${1:heading}} & \textbf{${2:heading}} & \textbf{${3:heading}} \\\\ \hline
+ ${4:cell} & ${5:cell} & ${6:cell} \\\\ \hline
+ $0 \\\\ \hline
+ \end{tabular}
+ \renewcommand{\arraystretch}{1}
+ \vspace{1em}
+ \caption{table}
+ \label{tab:whataver}
+\end{table}
+endsnippet
+
+snippet fig "Figure" b
+\begin{figure}[h]
+ \centering
+ \includegraphics[scale=0.5]{${1:/path/to/file}}
+ \caption{${2:caption}}
+ \label{fig:${3:internal reference}}
+\end{figure}
+endsnippet
+
+snippet fig "Subfigures" b
+\begin{figure}
+ \centering
+ \begin{subfigure}[b]{0.3\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{${1:/path/to/first.jpg}}
+ \caption{${2:caption}}
+ \label{fig:${3:internal label}}
+ \end{subfigure}
+ \hfill
+ \begin{subfigure}[b]{0.3\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{${4:/path/to/second}}
+ \caption{${5:caption}}
+ \label{fig:${6:internal label}}
+ \end{subfigure}
+ \hfill
+ \begin{subfigure}[b]{0.3\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{${7:/path/to/third}}
+ \caption{${8:caption}}
+ \label{fig:${9:internal label}}
+ \end{subfigure}
+ \caption{${10:overall caption}}
+ \label{fig:${11:overall internal label}}
+\end{figure}
endsnippet
# }}}
@@ -133,11 +222,11 @@ snippet b "bold text" w
\textbf{$1}
endsnippet
-snippet " "quote" w
+snippet " "quote" wA
\`\`$1''$0
endsnippet
-snippet ' "single quote" w
+snippet ' "single quote" wA
\`$1'$0
endsnippet
# }}}
@@ -205,10 +294,10 @@ stripped = match.string[:-1]
depth = 0
i = len(stripped) - 1
while True:
- if stripped[i] == ')': depth += 1
- if stripped[i] == '(': depth -= 1
- if depth == 0: break;
- i -= 1
+ if stripped[i] == ')': depth += 1
+ if stripped[i] == '(': depth -= 1
+ if depth == 0: break;
+ i -= 1
snip.rv = stripped[0:i] + "\\frac{" + stripped[i+1:-1] + "}"
`{$1}$0
endsnippet
diff --git a/vim/ultisnips/xml.snippets b/vim/ultisnips/xml.snippets
@@ -0,0 +1,26 @@
+snippet skel "A launchd job template" b
+<!-- Documentation here: https://www.launchd.info/ -->
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>Label</key>
+ <string>${1:com.example.app}</string>
+ <key>Program</key>
+ <string>${2:/path/to/script}</string>
+ <!--
+ <key>ProgramArguments</key>
+ <array>
+ <string></string>
+ <string></string>
+ </array>
+ -->
+ <key>RunAtLoad</key>
+ <${3:true if run on boot/login}/>
+ <key>StartInterval</key>
+ <integer>${4:interval in which to run in seconds; then keepalive should be false}</integer>
+ <key>KeepAlive</key>
+ <${5:true if the job should always be running, or e.g. dict with SuccessfulExit}/>
+ </dict>
+</plist>
+endsnippet