-
-
Save OrenBochman/06c87ba7ad810fa9f17d57534283cb8b to your computer and use it in GitHub Desktop.
Vimtex setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
snippet template "Basic template" b | |
\documentclass[a4paper]{article} | |
\usepackage[utf8]{inputenc} | |
\usepackage[T1]{fontenc} | |
\usepackage{textcomp} | |
\usepackage[dutch]{babel} | |
\usepackage{amsmath, amssymb} | |
\begin{document} | |
$0 | |
\end{document} | |
endsnippet | |
snippet "b(egin)?" "begin{} / end{}" br | |
\begin{${1:something}} | |
${0:${VISUAL}} | |
\end{$1} | |
endsnippet | |
snippet beg "begin{} / end{}" bA | |
\\begin{${1}} | |
${0} | |
\\end{$1} | |
endsnippet | |
snippet margin "margin note" A | |
\\marginpar{$1} | |
$0 | |
endsnippet | |
snippet ... "\ldots" iA | |
\ldots | |
endsnippet | |
snippet tab "tabular / array environment" b | |
\begin{${1:t}${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${2:c}} | |
$0${2/((?<=.)c|l|r)|./(?1: & )/g} | |
\end{$1${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}} | |
endsnippet | |
snippet table "Table environment" b | |
\begin{table}[${1:htpb}] | |
\centering | |
\caption{${2:caption}} | |
\label{tab:${3:label}} | |
\begin{tabular}{${5:c}} | |
$0${5/((?<=.)c|l|r)|./(?1: & )/g} | |
\end{tabular} | |
\end{table} | |
endsnippet | |
snippet fig "Figure environment" b | |
\begin{figure}[${1:htpb}] | |
\centering | |
${2:\includegraphics[width=0.8\textwidth]{$3}} | |
\caption{${4:$3}} | |
\label{fig:${5:$3}} | |
\end{figure} | |
endsnippet | |
snippet enum "Enumerate" bA | |
\begin{enumerate} | |
\item $0 | |
\end{enumerate} | |
endsnippet | |
snippet item "Itemize" bA | |
\begin{itemize} | |
\item $1 | |
$0 | |
\end{itemize} | |
endsnippet | |
snippet bul "bullet" bA | |
\item $1 | |
$0 | |
endsnippet | |
snippet desc "Description" b | |
\begin{description} | |
\item[$1] $0 | |
\end{description} | |
endsnippet | |
snippet it "Individual item" b | |
\item ${1} | |
$0 | |
endsnippet | |
snippet cha "Chapter" b | |
\chapter{${1:chapter name}} | |
\label{cha:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} | |
${0} | |
endsnippet | |
snippet sc "Section" b | |
\section{${1:section name}} | |
\label{sec:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} | |
${0} | |
endsnippet | |
snippet sub "Subsection" b | |
\subsection{${1:subsection name}} | |
\label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} | |
${0} | |
endsnippet | |
snippet ssub "Subsubsection" b | |
\subsubsection{${1:subsubsection name}} | |
\label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} | |
${0} | |
endsnippet | |
snippet par "Paragraph" b | |
\paragraph{${1:paragraph name}} | |
\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} | |
${0} | |
endsnippet | |
snippet subp "Subparagraph" b | |
\subparagraph{${1:subparagraph name}} | |
\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} | |
${0} | |
endsnippet | |
snippet pac "Package" b | |
\usepackage[${1:options}]{${2:package}}$0 | |
endsnippet | |
snippet => "implies" Ai | |
\implies | |
endsnippet | |
snippet iff "iff" Ai | |
\iff | |
endsnippet | |
############## | |
# MATH STUFF # | |
############## | |
snippet mm "Math" wA | |
$${1:${VISUAL}}$`!p | |
punctuation = t[2] and t[2][0] in [',', '.', '?', '-'] | |
if punctuation: | |
if len(t[2]) == 1: | |
t[2] = t[2] + (' ' if t[2][0] in [',', '.', '?'] else '') | |
snip.rv='' | |
else: | |
snip.rv=' ' | |
`$2 | |
endsnippet | |
snippet dm "Math" wA | |
\[ | |
${1:${VISUAL}} | |
\] $0 | |
endsnippet | |
snippet eq "Equation" b | |
\begin{equation} | |
$0 | |
\end{equation} | |
endsnippet | |
snippet eqnn "Equation without number" b | |
\begin{equation*} | |
$0 | |
\end{equation*} | |
endsnippet | |
snippet al "Align" b | |
\begin{align*} | |
${1:${VISUAL}} | |
\end{align*} | |
$0 | |
endsnippet | |
snippet ali "Align" bA | |
\begin{align*} | |
${1:${VISUAL}} | |
\end{align*} | |
$0 | |
endsnippet | |
snippet ar "Array" b | |
\begin{array*}{${1:rl}} | |
${2:} &= $3\\\\ | |
\end{array*} | |
endsnippet | |
snippet // "Fraction" iA | |
\\frac{$1}{$2}$0 | |
endsnippet | |
snippet f/ "Fraction" iA | |
\\frac{$1}{$2}$0 | |
endsnippet | |
priority 1000 | |
snippet '((\d+)?(\\)?([A-Za-z]+)(\^((\{\d+\})|(\d)))?)/' "symbol frac" wrA | |
\\frac{`!p snip.rv = match.group(1)`}{$1}$0 | |
endsnippet | |
priority 10 | |
snippet '(\d+)/' "number frac" wrA | |
\\frac{`!p snip.rv = match.group(1)`}{$1}$0 | |
endsnippet | |
snippet '^.*\)/' "() frac" wrA | |
`!p | |
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 | |
snip.rv = stripped[0:i] + "\\frac{" + stripped[i+1:-1] + "}" | |
`{$1}$0 | |
endsnippet | |
snippet '([A-Za-z])(\d)' "auto subscript" wrA | |
`!p snip.rv = match.group(1)`_`!p snip.rv = match.group(2)` | |
endsnippet | |
snippet '([A-Za-z])_(\d\d)' "auto subscript2" wrA | |
`!p snip.rv = match.group(1)`_{`!p snip.rv = match.group(2)`} | |
endsnippet | |
snippet sympy "sympyblock " w | |
sympy $1 sympy$0 | |
endsnippet | |
priority 10000 | |
snippet 'sympy(.*)sympy' "sympy" wr | |
`!p | |
from sympy import * | |
x, y, z, t = symbols('x y z t') | |
k, m, n = symbols('k m n', integer=True) | |
f, g, h = symbols('f g h', cls=Function) | |
init_printing() | |
snip.rv = eval('latex(' + match.group(1).replace('\\', '').replace('^', '**').replace('{', '(').replace('}', ')') + ')') | |
` | |
endsnippet | |
snippet == "equals" iA | |
&=$1\\\\ | |
endsnippet | |
snippet != "equals" iA | |
\neq | |
endsnippet | |
snippet ceil "ceil" iA | |
\left\lceil $1 \right\rceil $0 | |
endsnippet | |
snippet floor "floor" iA | |
\left\lfloor $1 \right\rfloor$0 | |
endsnippet | |
snippet mat "Smart Matrix" | |
\begin{${1:p/b/v/V/B/small}matrix} | |
$0 | |
\end{$1matrix} | |
endsnippet | |
snippet pmat "pmat" iA | |
\begin{pmatrix} | |
$1 | |
\end{pmatrix} | |
$0 | |
endsnippet | |
snippet bmat "bmat" iA | |
\begin{bmatrix} | |
$1 | |
\end{bmatrix} | |
$0 | |
endsnippet | |
snippet () "left( right)" iA | |
\left( ${1:${VISUAL}} \right) $0 | |
endsnippet | |
snippet lr "left( right)" i | |
\left( ${1:${VISUAL}} \right) $0 | |
endsnippet | |
snippet lr( "left( right)" i | |
\left( ${1:${VISUAL}} \right) $0 | |
endsnippet | |
snippet lr| "left| right|" i | |
\left| ${1:${VISUAL}} \right| $0 | |
endsnippet | |
snippet lr{ "left\{ right\}" i | |
\left\\{ ${1:${VISUAL}} \right\\} $0 | |
endsnippet | |
snippet lrb "left\{ right\}" i | |
\left\\{ ${1:${VISUAL}} \right\\} $0 | |
endsnippet | |
snippet lr[ "left[ right]" i | |
\left[ ${1:${VISUAL}} \right] $0 | |
endsnippet | |
snippet lra "leftangle rightangle" iA | |
\left<${1:${VISUAL}} \right>$0 | |
endsnippet | |
# snippet conj "conjugate" iA | |
# \overline{$1}$0 | |
# endsnippet | |
snippet dint "integral" w | |
\int_{${1:-\infty}}^{${2:\infty}} ${3:${VISUAL}}\: d${4:x} $0 | |
endsnippet | |
snippet int "integral" w | |
\int ${1:${VISUAL}}\: d${2:x} $0 | |
endsnippet | |
snippet sum "sum" w | |
\sum_{i=${1:0}}^{${3:n}} ${4:${VISUAL}} $0 | |
endsnippet | |
snippet taylor "taylor" w | |
\sum_{${1:k}=${2:0}}^{${3:\infty}} ${4:c_$1} (x-a)^$1 $0 | |
endsnippet | |
snippet lim "limit" w | |
\lim_{${1:n}\to${2:\infty}} | |
endsnippet | |
snippet prod "product" w | |
\prod_{${1:n=${2:1}}}^{${3:\infty}} ${4:${VISUAL}} $0 | |
endsnippet | |
snippet ddx "d/dx" wA | |
\frac{d${1:}}{dx} $0 | |
endsnippet | |
snippet ddt "d/dt" wA | |
\frac{d${1:}}{dt} $0 | |
endsnippet | |
snippet part "d/dx" w | |
\frac{\partial ${1:}}{\partial ${2:x}} $0 | |
endsnippet | |
# snippet dd "partial" wA | |
# \ddot{$1}$0 | |
# endsnippet | |
snippet sq "\sqrt{}" iA | |
\sqrt{${1:${VISUAL}}} $0 | |
endsnippet | |
snippet sr "^2" iA | |
^2 | |
endsnippet | |
snippet cb "^3" iA | |
^3 | |
endsnippet | |
snippet td "to the ... power" iA | |
^{$1}$0 | |
endsnippet | |
snippet __ "subscript" iA | |
_{$1}$0 | |
endsnippet | |
snippet ooo "\infty" iA | |
\infty | |
endsnippet | |
snippet rij "mrij" i | |
(${1:x}_${2:n})_{${3:$2}\\in${4:\\N}}$0 | |
endsnippet | |
snippet <= "leq" iA | |
\le | |
endsnippet | |
snippet >= "geq" iA | |
\ge | |
endsnippet | |
snippet EE "geq" iA | |
\exists | |
endsnippet | |
snippet xnn "xn" iA | |
x_{n} | |
endsnippet | |
snippet ynn "yn" iA | |
y_{n} | |
endsnippet | |
snippet xii "xi" iA | |
x_{i} | |
endsnippet | |
snippet yii "yi" iA | |
y_{i} | |
endsnippet | |
snippet xjj "xj" iA | |
x_{j} | |
endsnippet | |
snippet yjj "yj" iA | |
y_{j} | |
endsnippet | |
snippet xp1 "x" iA | |
x_{n+1} | |
endsnippet | |
snippet n0 "x" iA | |
n_{0} | |
endsnippet | |
snippet xmm "x" iA | |
x_{m} | |
endsnippet | |
snippet AA "forall" iA | |
\forall | |
endsnippet | |
snippet afa "afa" iA | |
\mathbb A | |
endsnippet | |
snippet EU "E" iA | |
\mathbb E | |
endsnippet | |
snippet R0+ "R0+" iA | |
\\R_0^+ | |
endsnippet | |
snippet plot "Plot" w | |
\begin{figure}[$1] | |
\centering | |
\begin{tikzpicture} | |
\begin{axis}[ | |
xmin= ${2:-10}, xmax= ${3:10}, | |
ymin= ${4:-10}, ymax = ${5:10}, | |
axis lines = middle, | |
] | |
\addplot[domain=$2:$3, samples=${6:100}]{$7}; | |
\end{axis} | |
\end{tikzpicture} | |
\caption{$8} | |
\label{${9:$8}} | |
\end{figure} | |
endsnippet | |
snippet nn "Tikz node" w | |
\node[$5] (${1/[^0-9a-zA-Z]//g}${2}) ${3:at (${4:0,0}) }{$${1}$}; | |
$0 | |
endsnippet | |
# snippet dr "Tikz draw" w | |
# \draw[${1}] (${2:0, 0}) -- $4(${3:0,0}); | |
# $0 | |
# endsnippet | |
snippet na "Tikz node above" w | |
node[above`!p snip.rv=', ' if t[2] else ''`${2}]{$${1}$} $0 | |
endsnippet | |
snippet nb "Tikz node below" w | |
node[below`!p snip.rv=', ' if t[2] else ''`${2}]{$${1}$} $0 | |
endsnippet | |
snippet nr "Tikz node right" w | |
node[right`!p snip.rv=', ' if t[2] else ''`${2}]{$${1}$} $0 | |
endsnippet | |
snippet nl "Tikz node left" w | |
node[left`!p snip.rv=', ' if t[2] else ''`${2}]{$${1}$} $0 | |
endsnippet | |
snippet nar "Tikz node above right" w | |
node[above right`!p snip.rv=', ' if t[2] else ''`${2}]{$${1}$} $0 | |
endsnippet | |
snippet nal "Tikz node above left" w | |
node[above left`!p snip.rv=', ' if t[2] else ''`${2}]{$${1}$} $0 | |
endsnippet | |
snippet nbr "Tikz node below right" w | |
node[below right`!p snip.rv=', ' if t[2] else ''`${2}]{$${1}$} $0 | |
endsnippet | |
snippet nbl "Tikz node below left" w | |
node[below left`!p snip.rv=', ' if t[2] else ''`${2}]{$${1}$} $0 | |
endsnippet | |
snippet frame "Tikz frame" w | |
\draw[help lines, <->] (-$1, 0) -- ($1, 0); | |
\draw[help lines, <->] (0, -$1) -- (0, $1); | |
$0 | |
endsnippet | |
snippet force "Tikz force" w | |
\draw[force] (${1:0, 0}) -- $3 ++(${2:0, 0}); | |
$0 | |
endsnippet | |
snippet tikz "Tikz" w | |
\begin{figure}[htb] | |
\centering | |
\begin{tikzpicture} | |
$0 | |
\end{tikzpicture} | |
\caption{$1} | |
\label{fig:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} | |
\end{figure} | |
endsnippet | |
snippet co "Tikz coordinate" w | |
coordinate ($1) $0 | |
endsnippet | |
snippet vec "Vector" iA | |
\vec | |
endsnippet | |
snippet mcal "mathcal" iA | |
\mathcal{$1}$0 | |
endsnippet | |
# snippet unit "unit vector" iA | |
# \vec e_{$1}$0 | |
# endsnippet | |
snippet lll "l" iA | |
\ell | |
endsnippet | |
snippet nabl "nabla" iA | |
\nabla | |
endsnippet | |
snippet xx "cross" iA | |
\times | |
endsnippet | |
snippet ** "cdot" iA | |
\cdot | |
endsnippet | |
snippet slide "slide" bA | |
\begin{slide}{$1} | |
$0 | |
\end{slide} | |
endsnippet | |
snippet '(?<!\\)formule' "formule" rwA | |
\formule{$1}{$2}$0 | |
endsnippet | |
snippet norm "norm" i | |
\|$1\|$0 | |
endsnippet | |
snippet '(?<!\\)arcsin' "sin" rwA | |
\arcsin | |
endsnippet | |
snippet '(?<!arc)(?<!\\)sine' "sine" rwA | |
\sin | |
endsnippet | |
snippet '(?<!\\)arccos' "cos" rwA | |
\arccos | |
endsnippet | |
snippet '(?<!arc)(?<!\\)cos' "cos" rwA | |
\cos | |
endsnippet | |
snippet '(?<!\\)arctan' "tan" rwA | |
\arctan | |
endsnippet | |
# snippet '(?<!arc)(?<!\\)tan' "tan" rwA | |
# \tan | |
# endsnippet | |
snippet '(?<!\\)arccot' "cot" rwA | |
\arccot | |
endsnippet | |
snippet '(?<!arc)(?<!\\)cot' "cot" rwA | |
\cot | |
endsnippet | |
snippet '(?<!\\)arccsc' "csc" rwA | |
\arccsc | |
endsnippet | |
snippet '(?<!arc)(?<!\\)csc' "csc" rwA | |
\csc | |
endsnippet | |
snippet '(?<!\\)arcsec' "sec" rwA | |
\arcsec | |
endsnippet | |
# snippet '(?<!arc)(?<!\\)sec' "sec" rwA | |
# \sec | |
# endsnippet | |
snippet '(?<!\\)ln' "ln" rwA | |
\ln | |
endsnippet | |
snippet '(?<!\\)exp' "exp" rwA | |
\exp | |
endsnippet | |
snippet '(?<!\\)logo' "logo" rwA | |
\log | |
endsnippet | |
snippet -> "to" iA | |
\to | |
endsnippet | |
snippet !> "mapsto" iA | |
\mapsto | |
endsnippet | |
snippet invs "inverse" iA | |
^{-1} | |
endsnippet | |
snippet CC "kromme" iA | |
\C | |
endsnippet | |
snippet LL "laplace" iA | |
\mathcal{L} | |
endsnippet | |
snippet HH "hamiltonian" iA | |
\mathcal{H} | |
endsnippet | |
snippet FF "overdekking" iA | |
\mathcal{F} | |
endsnippet | |
snippet \\\ "setminus" iA | |
\setminus | |
endsnippet | |
snippet >> ">>" iA | |
\gg | |
endsnippet | |
snippet << "<<" iA | |
\ll | |
endsnippet | |
snippet DD "delta" iA | |
\Delta | |
endsnippet | |
snippet ~~ "~" iA | |
\sim | |
endsnippet | |
snippet star "star" iA | |
^\star | |
endsnippet | |
snippet set "set" iA | |
\\{$1\\} $0 | |
endsnippet | |
snippet || "mid" iA | |
\mid | |
endsnippet | |
snippet cc "subset" iA | |
\subset | |
endsnippet | |
snippet bol "bol" i | |
\left(${1:x} - ${2:\delta}, $1 + $2\right) $0 | |
endsnippet | |
snippet inwend "mathring" i | |
\mathring | |
endsnippet | |
snippet sluit "overline" i | |
\overline{$1} $0 | |
endsnippet | |
snippet notin "not in " iA | |
\not\in | |
endsnippet | |
snippet inn "in " iA | |
\in | |
endsnippet | |
snippet fun "function" i | |
${1:f} :$2 \R \to \R | |
endsnippet | |
snippet NN "n" iA | |
\N | |
endsnippet | |
snippet Nn "cap" iA | |
\cap | |
endsnippet | |
snippet UU "cup" iA | |
\cup | |
endsnippet | |
snippet OO "emptyset" iA | |
\O | |
endsnippet | |
snippet RR "real" iA | |
\R | |
endsnippet | |
snippet RPn "Projective space" iA | |
\R \mathrm P^n | |
endsnippet | |
snippet QQ "Q" iA | |
\Q | |
endsnippet | |
snippet ZZ "Z" iA | |
\Z | |
endsnippet | |
# snippet opn "U" iA | |
# \mathcal U | |
# endsnippet | |
snippet bbb "borel" iA | |
\mathcal B | |
endsnippet | |
snippet BB "Bezier" iA | |
B_{${1:i}}^{${2:n}}(${3:t}) $0 | |
endsnippet | |
# snippet NN "Basespline" iA | |
# N_{${1:i}, ${2:k+1}}(${3:u}) $0 | |
# endsnippet | |
snippet dd "debohr" wA | |
\vec d_{${1:i}} | |
endsnippet | |
snippet l_2n "l2n" iA | |
\ell^2(\N) | |
endsnippet | |
snippet perp "perp" iA | |
\perp | |
endsnippet | |
snippet <! "normal" iA | |
\triangleleft | |
endsnippet | |
snippet <> "hokje" iA | |
\diamond | |
endsnippet | |
snippet sts "text subscript" iA | |
_\text{$1} $0 | |
endsnippet | |
snippet aca "group action" iA | |
{}^{$1}$0 | |
endsnippet | |
snippet dag "dag" bA | |
\dag{`date +'%A %0d %B' | sed 's/.*/\u&/'`} | |
$0 | |
endsnippet | |
snippet uur "uur" i | |
\uur{`date +'%H:%M'`} | |
endsnippet | |
snippet drm "drawmatrix" iA | |
\drawmatrix[$2]{$1} $0 | |
endsnippet | |
# vim:ft=snippets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Plugin 'lervag/vimtex' | |
let g:tex_flavor='latex' | |
let g:vimtex_view_method='zathura' | |
let g:vimtex_quickfix_mode=0 | |
set conceallevel=1 | |
let g:tex_conceal="abdmg" | |
" let g:vimtex_fold_enabled=1 slows down everything | |
" | |
nnoremap dm O\[<ESC>j>>o<BS>\]<ESC>k | |
nmap csm cs$ | |
nmap dsm ds$ | |
nmap dam da$ | |
nmap dim di$ | |
nmap cim ci$ | |
nmap cam ca$ | |
nmap vim vi$ | |
nmap vam va$ | |
Plugin '907th/vim-auto-save' | |
let g:auto_save_events = ["InsertLeave", "TextChanged"] | |
autocmd FileType tex let g:auto_save = 1 | |
autocmd FileType tex let g:auto_save_silent = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment