diff --git a/nvim/ultisnips/all.snippets b/nvim/ultisnips/all.snippets deleted file mode 100644 index 10dac72..0000000 --- a/nvim/ultisnips/all.snippets +++ /dev/null @@ -1,105 +0,0 @@ -global !p -from datetime import datetime, timedelta - -def relative_date(days = 0): - time_difference = timedelta(days=int(days)) - calculated_date = datetime.today() + time_difference - - return calculated_date -endglobal - -snippet "reldate (-?\d+)( .+)?" "Prints out the relative date in ISO format." ri -`!p -reldate = relative_date(match.group(1)) -date_format = match.group(2).strip(" \"") if match.group(2) is not None else "%F" -snip.rv = reldate.strftime(date_format) -` -endsnippet - -snippet today "Prints out today's date in ISO format" i -`!p -from datetime import datetime - -snip.rv = datetime.today().strftime("%F") -` -endsnippet - - -# Quick formatting. -snippet sign "Quick signature" i -${1:Sincerely,} -${2:Gabriel Arazas} -$0 -endsnippet - -snippet retrieve "Quick retrieval date in informal format" i -(retrieved `!p snip.rv = datetime.today().strftime("%F")`) -endsnippet - -snippet ie "Parenthetical material Latin 'id est' (ie)" iw -(i.e., $1) $0 -endsnippet - -snippet eg "Parenthetical material Latin 'exempli gratia' (eg)" iw -(e.g., $1) $0 -endsnippet - - -# En dashes -snippet -- "En dash" -– -endsnippet - - -# Em dashes (I've these dedicated snippets for some reason). -snippet --- "Em dash" -— -endsnippet - -snippet em "Quick em dash" -— -endsnippet - -snippet em-mat "Em dash material" iw -— $1 — $0 -endsnippet - -snippet em-ie "'id est' surrounded with em dash" iw -— i.e., $1 — $0 -endsnippet - -snippet em-eg "'exempli gratia' surrounded with em dash" iw -— e.g., $1 — $0 -endsnippet - - -# Quick word snippets -# Each of these quick word snippets has a prefix of `qw-` -snippet qw-lx "LaTeX" iw -LaTeX -endsnippet - -snippet qw-as "Asciidoctor" iw -Asciidoctor -endsnippet - - -# Miscellaneous snippets -snippet #! "Quick snippet for a shebang." bi -#!${1:/usr/bin/env} ${2:sh} -endsnippet - -# This is only useful for decorative comment boxes and all of the jazz. -snippet "boxen (.*)" "Create a box of stuff" ir -`!p snip.rv = (match.group(1) * (len(t[1]) + 4)).strip()[0:(len(t[1]) + 4)]` -`!p snip.rv = match.group(1)[0]` $1 `!p snip.rv = match.group(1)[0]` -`!p snip.rv = (match.group(1) * (len(t[1]) + 4)).strip()[0:(len(t[1]) + 4)]` -endsnippet - -# Also stolen from Gilles Castel's post at https://castel.dev/post/lecture-notes-1/. -snippet box "More box (that looks more like a box)." -`!p snip.rv = '┌' + '─' * (len(t[1]) + 2) + '┐'` -│ $1 │ -`!p snip.rv = '└' + '─' * (len(t[1]) + 2) + '┘'` -endsnippet - diff --git a/nvim/ultisnips/asciidoc.snippets b/nvim/ultisnips/asciidoc.snippets deleted file mode 100644 index a2b38c5..0000000 --- a/nvim/ultisnips/asciidoc.snippets +++ /dev/null @@ -1,234 +0,0 @@ -global !p -# Smartly automate inserting of certain characters. -# Mainly used for smart space insertion. -def smart_space(next_str, auto_str=" ", loose=False): - next_word = "" - - if next_str: - if loose == True: - next_word = auto_str - elif next_str[0] in [",", ".", "-", "!", "?", " "]: - next_word = auto_str - - return next_word -endglobal - -# Text formatting -snippet "h(([1-6]))" "Quick header snippet" bir -`!p -header_level = int(match.group(1)) -legit_header_level = True if header_level >= 1 and header_level <= 6 else False - -if header_level == 2: - snip.rv = "\n" * 4 -else: - snip.rv = "\n" * 2 - -snip.rv += "=" * header_level if legit_header_level else "" -` ${1:Chapter name} - -$0 -endsnippet - -snippet bf "Boldface" iw -**$1** $0 -endsnippet - -snippet it "Italic" iw -__$1__ $0 -endsnippet - -snippet tt "Monospace" iw -\`$1\` $0 -endsnippet - -snippet hl "Highlighted text" iw -#$1# $0 -endsnippet - -snippet a "Hyperlink" iw -${1:}[${2:}] $0 -endsnippet - -snippet link "Link for files" iw -link:${1:}[${2:\`$1\`}] -endsnippet - -snippet sp "Superscript" iw -^$1^ $0 -endsnippet - -snippet sb "Subscript" iw -~$1~ $0 -endsnippet - -snippet dt "Definition term" bi -${1:}:: -${2:} -$0 -endsnippet - -snippet ul "Unordered list item" bi -* ${1:} -$0 -endsnippet - -snippet ol "Ordered list item" bi -. ${1:} -$0 -endsnippet - -snippet -ol "Reversed ordered list (use it only once in a list)" bi -[%reversed] -. ${1:} -endsnippet - -snippet bquote "Blockquote" bi ----- -$1 ----- -$0 -endsnippet - -snippet src "Source code listings" bi -[source`!p snip.rv=smart_space(t[1], ", ", loose=True)`${1:}] ----- -${2:} ----- -$0 -endsnippet - -snippet "-table (\d+)-" "Make a quick table" bir -[cols="`!p snip.rv = match.group(1)`*"] -|=== - -$1 - -|=== -$0 -endsnippet - -snippet "-table h (\d+)-" "Make a quick table with the headers already set up" bir -[cols="`!p snip.rv = match.group(1)`", options="headers"`!p snip.rv=smart_space(t[1], ", ", loose=True)`$1] -|=== -`!p -number_of_headers = int(match.group(1)) - -for i in range(0, number_of_headers): - snip += f"| Header {i + 1}" -` -$2 - -|=== -$0 -endsnippet - -# Multimedia blocks -snippet figure "Image block with caption" bi -.${2:} -image::${1:}[$2, ${3:width=100%,height=100%}] -$0 -endsnippet - -snippet -figure "Inline image" i -image:${1:}[${2}] $0 -endsnippet - -snippet video "Video block" bi -video::${1:}[$2] -$0 -endsnippet - -snippet youtube "YouTube video block" bi -video::${1:}[youtube] -$0 -endsnippet - -snippet vimeo "Vimeo video block" bi -video::${1:}[vimeo] -$0 -endsnippet - -snippet audio "Audio block" bi -audio::${1:}[`!p snip.rv=smart_space(t[2], "options=", loose=True)`$2] -$0 -endsnippet - -# Other features -snippet incl "Include document" bi -include::${1:}[${2:}] -$0 -endsnippet - -snippet oblock "Open block" bi --- -$1 --- -$0 -endsnippet - -snippet verbatim "Literal text block" bi -.... -$1 -.... -$0 -endsnippet - - -snippet sidebar "Sidebar as an open block" bi -[sidebar] -.${1:} --- -$2 --- -$0 -endsnippet - -snippet abstract "Abstract block" bi -[abstract] -== ${1:Summary} -$0 -endsnippet - -snippet append "Appendix block" bi -`!p snip.rv = "\n" * 4` -[appendix] -== ${1:Additional readings} -$0 -endsnippet - -snippet bibres "Bibliographical resource in a definition block" bi -${1:<link>}[${2:<title>}] (retrieved ${3:date}):: -${4:<description>} -endsnippet - - -snippet sidebar "Sidebar block" bi -${1:.<optional title>} -**** -$2 -**** -endsnippet - -snippet stem "Stem block" bi -[stem] -++++ -$1 -++++ -$0 -endsnippet - -snippet stem "Stem macro" iw -stem:[$1] $0 -endsnippet - -snippet foot "Footnote macro" iw -footnote:[$1] $0 -endsnippet - -snippet qn "Question and answer" iw -[qanda] -${1:QUESTION}:: -${2:ANSWER} -endsnippet - diff --git a/nvim/ultisnips/dhall.snippets b/nvim/ultisnips/dhall.snippets deleted file mode 100644 index c8ce06e..0000000 --- a/nvim/ultisnips/dhall.snippets +++ /dev/null @@ -1,4 +0,0 @@ -snippet func "Function" -λ(${1:$PARAM : $TYPE}) → ${2:OUTPUT} $0 -endsnippet - diff --git a/nvim/ultisnips/markdown.snippets b/nvim/ultisnips/markdown.snippets deleted file mode 100644 index 135e3b5..0000000 --- a/nvim/ultisnips/markdown.snippets +++ /dev/null @@ -1,22 +0,0 @@ -# Text formatting -snippet bf "Boldface" iw -**$1** -endsnippet - -snippet tt "Teletype (or monospace text)" iw -\`$1\` -endsnippet - - -# Content formatting -snippet src "Source code listing" bi -```$1 -$2 -``` -$0 -endsnippet - -snippet link "Quick link" i -[$1]($2) -endsnippet - diff --git a/nvim/ultisnips/nix.snippets b/nvim/ultisnips/nix.snippets deleted file mode 100644 index a56b314..0000000 --- a/nvim/ultisnips/nix.snippets +++ /dev/null @@ -1,56 +0,0 @@ -snippet shell "Nix shell template" b -{ pkgs ? import <nixpkgs> {} }: - -with pkgs; - -mkShell { - buildInputs = [ - ${1} - ]; -} -endsnippet - -snippet mkDerivation "Shorthand for stdenv.mkDerivation" b -{ stdenv, lib, $1 }: - -stdenv.mkDerivation rec { - $2 -} -endsnippet - -snippet buildGoModule "Shorthand for building Go modules" b -{ stdenv, lib, buildGoModule, $1 }: - -buildGoModule rec { - pname = $1; - version = $2; - - vendorSha256 = ""; -} -endsnippet - -snippet homeManagerModule "A file template for " <flags> -{ config, options, lib, pkgs, ... }: - -let - cfg = config.$1; -in { - options.$1 = { - enable = lib.mkEnableOption "$2"; - }; - - config = lib.mkIf cfg.enable { - }; -} -endsnippet - -snippet mkOption "lib.mkOption from nixpkgs" i -lib.mkOption { - type = $1; - description = $2; - default = $3; - example = $4; - $5 -} -endsnippet - diff --git a/nvim/ultisnips/nroff.snippets b/nvim/ultisnips/nroff.snippets deleted file mode 100644 index dbe936e..0000000 --- a/nvim/ultisnips/nroff.snippets +++ /dev/null @@ -1,74 +0,0 @@ -# Text formatting -snippet p "Paragraph" bi -.PP -$0 -endsnippet - -snippet bf "Boldface" iw -.ft B -$1 -.ft -$0 -endsnippet - -snippet it "Italic" iw -.ft I -$1 -.ft -$0 -endsnippet - -snippet bfit "Boldface italic" iw -.ft BI -$1 -.ft -$0 -endsnippet - -# Document structures -snippet title "Title header" bi -.TH ${1:TITLE} ${2:SECTION} ${3:EXTRA} -$0 -endsnippet - -snippet sect "Sectioned (unnumbered) headers" bi -.SH ${1:SECTION NAME} -$0 -endsnippet - -snippet ss "Subsectioned (unnumbered) headers" bi -.SS ${1:SUBSECTION NAME} -$0 -endsnippet - -snippet ol "Ordered list setup" bi -.nr step 1 1 - -.IP \n+[step] -$1 -$0 -endsnippet - -snippet oli "Ordered list item" bi -.IP \n+[step] -$1 -$0 -endsnippet - -snippet uli "Unordered list item" bi -.IP \[bu] -$1 -$0 -endsnippet - -snippet dl "Definition-style list item" bi -.IP ${1:WORD} -${2:DESCRIPTION} -$0 -endsnippet - -snippet eq "Equation" bi -.EQ -${1:EQUATION} -.EN -endsnippet diff --git a/nvim/ultisnips/python.snippets b/nvim/ultisnips/python.snippets deleted file mode 100644 index 9968b11..0000000 --- a/nvim/ultisnips/python.snippets +++ /dev/null @@ -1,72 +0,0 @@ -global !p -# Smartly automate inserting of certain characters. -# Mainly used for smart space insertion. -def smart_space(next_str, auto_str=" ", loose=False): - next_word = "" - - if next_str: - if loose == True: - next_word = auto_str - elif next_str[0] in [",", ".", "-", "!", "?", " "]: - next_word = auto_str - - return next_word -endglobal - -snippet def "Define function with autocompleting docstrings" iw -def ${1:function_name}($2): - """ - ${3:To be defined} -`!p -arguments = [ arg.strip() for arg in t[2].split(',') if arg != "self" or len(arg.strip()) > 0 ] - -# Format the string with an indent. -snip >> 1 -for arg in arguments: - split_arg = arg.split('=') - - param = split_arg[0].strip() - if param: - snip += f":param: {param} - @TODO" -` - """ -endsnippet - -# Quickly create a class definition. -# This is inspired from the demo GIF from the official GitHub page at https://github.com/sirver/UltiSnips. -snippet class "Class keyword with autocompleting docstrings" iw -class ${1:PICK_A_NAME_CLASS}`!p snip.rv = smart_space(t[2], '(', loose=True)`$2`!p snip.rv = smart_space(t[2], ')', loose=True)`: - """ ${3:Docstring for $1} """ - - def __init__(${4:self}): - """ - ${5:Creates an instance of $1} -`!p -arguments = [ arg.strip() for arg in t[4].split(',') if arg != "self" or len(arg.strip()) > 0 ] - -# Format the string with an indent. -snip >> 2 - -for arg in arguments: - split_arg = arg.split('=') - - param = split_arg[0].strip() - - if param: - snip += f":param: {param} - @TODO" -` - """ - -`!p -# Shift by two indentation level -snip >> 2 -snip += "" if not t[2] else f"{t[2]}.__init__(self)" -` - $6 -endsnippet - -snippet if_main "If __main__" biw -if __name__ == "__main__": - ${1:print("Hello world!")} -endsnippet - diff --git a/nvim/ultisnips/sh.snippets b/nvim/ultisnips/sh.snippets deleted file mode 100644 index 28713a7..0000000 --- a/nvim/ultisnips/sh.snippets +++ /dev/null @@ -1,54 +0,0 @@ -snippet if "If statement" iw -if [[ ${1:<condition>} ]]; then - ${2:<expression>} -fi -endsnippet - -snippet while_shift "A dependency-less option parser" iw -while [[ $# -gt 0 ]]; then -do - case $1 in - -h|--help) - echo "$help_section" - exit 0 - ;; - $2 - esac -done -endsnippet - -snippet if "If conditional" iw -if ${1:<expression>}; then -${2:<expression>} -fi -endsnippet - -snippet while "While loop" iw -while ${1:<expression>}; -do - ${2:<expression>} -done -endsnippet - -snippet select "Select loop stuff" iw -select ${1:<VARIABLE_NAME>} in ${2:foo bar baz} -do - ${3:# Your stuff here} -done -$0 -endsnippet - -snippet getopts "An argument parser with getopts" iw -while getopts ${1:<OPTSTRING>} ${2:arg} -do - case ${2:"h"} in - h) - echo $_help - exit 0 - *) - echo $_help - exit 0 - esca -done -endsnippet - diff --git a/nvim/ultisnips/snippets.snippets b/nvim/ultisnips/snippets.snippets deleted file mode 100644 index 98164cb..0000000 --- a/nvim/ultisnips/snippets.snippets +++ /dev/null @@ -1,14 +0,0 @@ -snippet usnip "A working snippet for creating UltiSnips snippets" ib -`!p snip.rv = "snippet"` ${1:<word_trigger>} "${2:<description>}" ${3:<flags>} -$4 -`!p snip.rv = "endsnippet"` -$0 -endsnippet - -snippet uglobal "A working global snippets for UltiSnips" ib -`!p snip.rv = "global"` ${2:!p} -$1 -`!p snip.rv = "endglobal"` -$0 -endsnippet - diff --git a/nvim/ultisnips/tex.snippets b/nvim/ultisnips/tex.snippets deleted file mode 100644 index fffb584..0000000 --- a/nvim/ultisnips/tex.snippets +++ /dev/null @@ -1,1191 +0,0 @@ -global !p -texMathZones = ['texMathZone'+x for x in ['A', 'AS', 'B', 'BS', 'C', 'CS', 'D', 'DS', 'E', 'ES', 'F', 'FS', 'G', 'GS', 'H', 'HS', 'I', 'IS', 'J', 'JS', 'K', 'KS', 'L', 'LS', 'DS', 'V', 'W', 'X', 'Y', 'Z']] - -texIgnoreMathZones = ['texMathText'] - -texMathZoneIds = vim.eval('map('+str(texMathZones)+", 'hlID(v:val)')") -texIgnoreMathZoneIds = vim.eval('map('+str(texIgnoreMathZones)+", 'hlID(v:val)')") - -ignore = texIgnoreMathZoneIds[0] -labelPrefix = "!" - -def math(): - 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 - - -def smart_space(next_str, auto_str=" ", loose=False): - next_word = "" - - if next_str: - if loose == True: - next_word = auto_str - elif next_str[0] in [",", ".", "-", "!", "?", " "]: - next_word = auto_str - - return next_word - -def add_variable_numbers(*inputs, **kwargs): - absolute = kwargs.pop("absolute", False) - total = 0 - - for t in inputs: - try: - i = int(t) - if absolute is True: - total += abs(i) - else: - total += i - except ValueError: - continue - - return total - -endglobal - -snippet template "Main template (that should work without relying with style files)" bi -\documentclass[class=memoir, crop=false, oneside, 14pt]{standalone} - -% all of the packages to be used -\usepackage[nocomments]{standalone} -\usepackage[utf8]{inputenc} -\usepackage{fontawesome} -\usepackage[english]{babel} -\usepackage[rgb]{xcolor} -\usepackage{amsmath} -\usepackage{amssymb} -\usepackage{amsthm} -\usepackage{tikz} -\usepackage{pgfplots} -\usepackage{fancyhdr} -\usepackage{minted} -\usepackage[most]{tcolorbox} -\usepackage[colorlinks=true, linkcolor=., urlcolor=blue]{hyperref} -\usepackage{kpfonts} - -% using the fancy header package -% http://linorg.usp.br/CTAN/macros/latex/contrib/fancyhdr/fancyhdr.pdf -\pagestyle{fancy} - -% fill the header with the format -\fancyhead[L]{\doctitle} -\fancyhead[R]{\nouppercase{\rightmark}} - -% fill the footer with the format -\fancyfoot[C]{\nouppercase{\leftmark}} -\fancyfoot[R]{\thepage} - -% set the width of the horizontal bars in the header -\renewcommand{\headrulewidth}{2pt} -\renewcommand{\footrulewidth}{1pt} - -% set the paragraph formatting -\renewcommand{\baselinestretch}{1.35} - -% set chapter style -\chapterstyle{bianchi} - -% set chapter spacing for easier reading on digital screen -\setlength{\beforechapskip}{-\beforechapskip} - -% document metadata -\author{${1:"Gabriel Arazas"}} -\title{${2:"New Title"}} -\date{`!p -`} - -\begin{document} -% Frontmatter of the class note if it's compiled standalone -\renewcommand{\abstractname}{Summary} -\maketitle -\newpage - -\frontmatter -\chapter{Preface} -$3 -\newpage - -\tableofcontents -\newpage - -\listoffigures -\newpage - -\mainmatter -% Core content (HINT: always start with chapter LaTeX tag) - -$0 -\end{document} -endsnippet - -# Document structure tags -snippet chapter "Chapter element" bi -\chapter{$1} -\label{chap!$1} -$0 -endsnippet - -snippet section "Section tag" bi -\section{$1} -\label{sect!$1} -$0 -endsnippet - -snippet subsec "Subsection tag" bi -\subsection{$1} -\label{subsect!$1} -$0 -endsnippet - -# Common commands -snippet pack "Use package command" bis -\usepackage`!p snip.rv=smart_space(t[2], "[",loose=True)`$2`!p snip.rv=smart_space(t[2], "]",loose=True)`{$1} -$0 -endsnippet - -snippet letter "Make at letter block" bis -\makeatletter -$1 -\makeatother -$0 -endsnippet - -snippet label "Create a label" bi -\label{$1} -$0 -endsnippet - -snippet ref "Create a reference for a label" bi -\ref{${1:<label to be referenced>}} $0 -endsnippet - -snippet algoref "Quick algorithm reference command" wi -Algorithm \ref{algo!$1} $0 -endsnippet - -snippet chapref "Quick chapter reference command" wi -Chapter \ref{chap!$1} $0 -endsnippet - -snippet coderef "Quick code reference command" wi -Code \ref{code!$1} $0 -endsnippet - -snippet defnref "Quick definition reference command" wi -Definition \ref{defn!$1} $0 -endsnippet - -snippet figref "Quick figure reference command" wi -Figure \ref{fig!$1} $0 -endsnippet - -snippet listref "Quick list reference command" wi -List \ref{list!$1} $0 -endsnippet - -snippet mathref "Quick mathematics reference command" wi -Equation \ref{math!$1} $0 -endsnippet - -snippet partref "Quick part reference command" wi -Part \ref{part!$1} $0 -endsnippet - -snippet proofref "Quick proof reference command" wi -Proof \ref{proof!$1} $0 -endsnippet - -snippet propref "Quick property reference command" wi -Property \ref{prop!$1} $0 -endsnippet - -snippet secref "Quick section reference command" wi -Section \ref{sect!$1} $0 -endsnippet - -snippet subsecref "Quick subsection reference command" wi -Subsection \ref{subsect!$1} $0 -endsnippet - -snippet tabref "Quick table referenece command" wi -Table \ref{table!$1} $0 -endsnippet - -snippet theoref "Quick theorem reference command" wi -Theorem \ref{theorem!$1} $0 -endsnippet - -snippet foot "Footnote" w -\footnote{${1:<text>}} $0 -endsnippet - -# Common environments -snippet begin "Simple empty environment" bi -\begin{$1} - $2 -\end{$1} -$0 -endsnippet - -snippet mi "Math mode (inline)" i -$${1}$`!p smart_space(t[2])`$2 -endsnippet - -snippet mb "Math block" bi -\begin{equation*} -`!p snip.rv=smart_space(t[1], " \label{math!", loose=True)`$1`!p snip.rv=smart_space(t[1], "}", loose=True)` - $2 -\end{equation*} -$0 -endsnippet - -snippet eq "Equation environment for mathematical typesetting" biw -\begin{equation} - \label{math!$1} - $2 -\end{equation} -$0 -endsnippet - -snippet subeq "Subequation environment" biw -\begin{subequations} - \label{math!$1} - $2 -\end{subequations} -$0 -endsnippet - -snippet align "Align equations environment" biw -\begin{align} - $1 -\end{align} -$0 -endsnippet - -snippet alignli "Quick align equation with label" biw -${1:<LHS>} &= ${2:<RHS>} \label{math!$3} \\ $4 -endsnippet - -snippet gathered "Gathered environment which lets you gather a bunch of equations and assign them under one equation number" bi -\begin{gathered} - \label{math!$1} - $2 -\end{gathered} -$0 -endsnippet - -snippet proof "Proof" biw -\begin{proof} - \label{proof!$1} - $2 -\end{proof} -$0 -endsnippet - -snippet figure "Figure environment" biw -\begin{figure} - \centering - \label{fig!$1} - $2 - \caption{${3:$1}} -\end{figure} -$0 -endsnippet - -snippet graph "Quickly make a graph" bi -\begin{figure}[${1:ht}] - \centering - \begin{tikzpicture} - \begin{axis}[ - xlabel=${2:$x$}, - ylabel=${3:$y$}, - axis lines = middle, - grid=major, - axis equal=false, - tick style={very thick}, - major tick style=thick, - domain=${4:-10}:${5:10},`!p snip.rv = smart_space(t[6], "\n\t", loose=True)`$6 - ] - \addplot[samples=${7:`!p snip.rv = add_variable_numbers(t[4], t[5], 1, absolute=True)`},$8]{${9:x}}; - \end{axis} - \end{tikzpicture} - \caption{$10} - \label{fig!${11:$10}} -\end{figure} -$0 -endsnippet - -snippet agraph "Quickly plot a graph without considering integers" bi -\begin{figure}[${1:ht}] - \centering - \begin{tikzpicture} - \begin{axis}[ - xlabel=${2:$x$}, - ylabel=${3:$y$}, - axis lines = middle, - grid=major, - axis equal=false, - tick style={very thick}, - major tick style=thick, - minor tick num=2, - domain=${4:-10}:${5:10},`!p snip.rv=smart_space(t[6], "\n\t", loose=True)`$6 - ] - \addplot[samples=${7:`!p snip.rv=add_variable_numbers(t[4], t[5], absolute=True)`}, $8]{${9:x}}; - \end{axis} - \end{tikzpicture} - \caption{$10} - \label{fig!${11:$10}} -\end{figure} -$0 -endsnippet - -snippet graph3 "3D graph from pgfplots package" bi -\begin{figure}[${1:ht}] -\centering -\begin{tikzpicture} - \begin{axis}[ - xlabel=${2:$x$}, - ylabel=${3:$y$}, - grid=major, - axis equal=false, - tick style={very thick}, - major tick style=thick, - domain=${4:-10}:${5:10},`!p snip.rv = smart_space(t[6], "\n\t", loose=True)`$6 - ] - \addplot3[samples=${7:`!p snip.rv = add_variable_numbers(t[4], t[5], 1, absolute=True)`},$8]{${9:x}}; - \end{axis} -\end{tikzpicture} -\caption{$10} -\label{fig!${11:$10}} -\end{figure} -$0 -endsnippet - -snippet plot "Add a plot line" i -\addplot[domain=$1:$2, samples=${3:`!p snip.rv=add_variable_numbers(t[1], t[2], 1, absolute=True)`}]`!p snip.rv=smart_space(t[4], ", ")`$4{${5: x}} -$0 -endsnippet - -snippet plot3 "Add a 3D plot" i -\addplot3[domain=$1:$2, samples=${3:`!p snip.rv=add_variable_numbers(t[1], t[2], 1, absolute=True)`}]`!p snip.rv=smart_space(t[4], ", ")`$4{${5:x}} -$0 -endsnippet - -# Common mathematical functions and symbols -# Also take note that most expressions are prepended with 'M' to mean mathematical usage -snippet === "Equivalent to" iw -\equiv -endsnippet - -snippet ~= "Congruent to" iw -\cong -endsnippet - -snippet ~~ "Approximately equal to" iw -\approx -endsnippet - -snippet p= "Proportional to" iw -\propto -endsnippet - -snippet != "Not equal" iw -\neq -endsnippet - -snippet >= "Greater than or equal to" iw -\geq -endsnippet - -snippet !> "Not greater than" iw -\ngtr -endsnippet - -snippet <= "Less than or equal to" iw -\leq -endsnippet - -snippet !< "Not less than" iw -\nless -endsnippet - -snippet <-- "Precedes symbol" iw -\prec -endsnippet - -snippet =<- "Precedes or equals" iw -\preceq -endsnippet - -snippet !<- "Not precedes" iw -\nprec -endsnippet - -snippet --> "Succeeds symbol" iw -\succ -endsnippet - -snippet =-> "Succeeds or equals" iw -\succeq -endsnippet - -snippet !-> "Not succeeds" iw -\nsucc -endsnippet - -snippet << "Less order than" iw -\ll -endsnippet - -snippet >> "Greater order than" iw -\gg -endsnippet - -context "math()" -snippet int "Integral symbol" iw -\int -endsnippet - -context "math()" -snippet -int "Integral with values" iw -\int_{${1:<lower bound>}}^{${2:<upper bound}}$0 -endsnippet - -context "math()" -snippet OO "Empty set" iw -\O -endsnippet - -context "math()" -snippet -sq "Square superscript" iw -^{2}$0 -endsnippet - -context "math()" -snippet -cb "Cube superscript" iw -^{3}$0 -endsnippet - -context "math()" -snippet -- "Superscript" iA -^{$1}$0 -endsnippet - -context "math()" -snippet __ "Subscript" iA -_{$1}$0 -endsnippet - -snippet ... "Ellipsis" iA -\ldots -endsnippet - -snippet c.. "Centered ellipsis" iw -\cdots -endsnippet - -snippet v.. "Vertical ellipsis" iw -\vdots -endsnippet - -snippet d.. "Diagonal ellipsis" iw -\ddots -endsnippet - -context "math()" -snippet Mbc "Mathematical because symbol" iw -\because -endsnippet - -context "math()" -snippet Mth "Mathematical therefore symbol" iw -\therefore -endsnippet - -context "math()" -snippet exp "Expression" iw -\exp(${1:x}} $0 -endsnippet - -context "math()" -snippet frac "Fraction" iw -\frac{${1:<enumerator>}{${2:<denominator}} -$0 -endsnippet - -context "math()" -snippet "-(\d+|\w+) over (\d+|\w+)-" "Quick fraction" riwA -`!p snip.rv = f"\\frac{{{match.group(1)}}}{{{match.group(2)}}}"` -$0 -endsnippet - -context "math()" -snippet "-(\d+|\w+) / (\d+|\w+)-" "Quick fraction" riwA -`!p snip.rv = f"\\frac{{{match.group(1)}}}{{{match.group(2)}}}"` -$0 -endsnippet - -context "math()" -snippet "\*" "Quick multiplication binary operator" riA -\cdot -endsnippet - -context "math()" -snippet mod "Mod operator (as binary operator)" iw -\bmod $0 -endsnippet - -## Common notations -context "math()" -snippet sum "Sigma notation symbol" iw -\sum -endsnippet - -context "math()" -snippet -sum "Sigma notation" iw -\sum_{${1:<lower bound>}^{${2:<upper bound>}} f(${3:<function expression>}) -$0 -endsnippet - -context "math()" -snippet prod "Product notation symbol" iw -\prod -endsnippet - -context "math()" -snippet -prod "Product notation" iw -\prod_{${1:<lower bound>}^{${2:upper bound}} f(${3:<function expression>}) -$0 -endsnippet - -context "math()" -snippet lim "Limit keyword" iw -\lim -endsnippet - -context "math()" -snippet -lim "Limit operator" iw -\lim\limits_{${1:x \to \infty}} -endsnippet - -context "math()" -snippet ooo "Infinity symbol" iw -\infty -endsnippet - -context "math()" -snippet inf "Infinity symbol" iw -\infty -endsnippet - -context "math()" -snippet choose "Choose function" iw -\binom{${1:<range>}}{${2:<N>}} -$0 -endsnippet - -context "math()" -snippet "-(\d+|\w+) choose (\d+|\w+)-" "Quick choose function" riwA -`!p snip.rv = f"\\binom{{{match.group(1)}}}{{{match.group(2)}}}"` -$0 -endsnippet - -## Common sets of numbers -context "math()" -snippet SN "Set of natural numbers" iw -\N -endsnippet - -context "math()" -snippet SZ "Set of integers" iw -\Z -endsnippet - -context "math()" -snippet SQ "Set of rational numbers" iw -\Q -endsnippet - -context "math()" -snippet SA "Set of algebraic numbers" iw -\mathbb{A} -endsnippet - -context "math()" -snippet SR "Set of real numbers" iw -\R -endsnippet - -context "math()" -snippet SC "Set of complex numbers" iw -\C -endsnippet - -## Common mathematical logic symbols -context "math()" -snippet Lin "Logical in symbol" iw -\in -endsnippet - -context "math()" -snippet L!in "Logical not in symbol" iw -\notin -endsnippet - -context "math()" -snippet Lon "Logical owns symbol" iw -\ni -endsnippet - -context "math()" -snippet LSu "Logical set union" iw -\cup -endsnippet - -context "math()" -snippet LSi "Logical set interaction" iw -\cap -endsnippet - -context "math()" -snippet LSd "Logical set difference" iw -\setminus -endsnippet - -context "math()" -snippet Lex "There exists at least one" iw -\exists -endsnippet - -context "math()" -snippet Lex! "There exists one and only one" iw -\exists! -endsnippet - -context "math()" -snippet L!ex "Not exists" iw -\nexists -endsnippet - -context "math()" -snippet Lfa "For all" iw -\forall -endsnippet - -context "math()" -snippet Lor "Logical 'or' symbol" iw -\lor -endsnippet - -context "math()" -snippet Land "Logical 'and' symbol" iw -\land -endsnippet - -context "math()" -snippet Lnot "Logical 'not' symbol" iw -\neg -endsnippet - -context "math()" -snippet => "Implies" Aiw -\implies -endsnippet - -context "math()" -snippet =< "Implied by" Aiw -\impliedby -endsnippet - -context "math()" -snippet <=> "If and only if" iw -\iff -endsnippet - -context "math()" -snippet iff "If and only if" iw -\iff -endsnippet - -context "math()" -snippet (( "Subset" iw -\subset -endsnippet - -context "math()" -snippet !( "Not a proper subset" iw -\not\subset -endsnippet - -context "math()" -snippet =( "Subset is equal to" iw -\subseteq -endsnippet - -context "math()" -snippet !=( "Not a subset of" iw -\nsubseteq -endsnippet - -context "math()" -snippet )) "A proper subset of" iw -\supset -endsnippet - -context "math()" -snippet !) "Not a proper superset of" iw -\not\supset -endsnippet - -context "math()" -snippet =) "A subset of" iw -\supseteq -endsnippet - -context "math()" -snippet !=) "Not a superset of" iw -\nsupseteq -endsnippet - -## Common functions -### Trigonometric functions -context "math()" -snippet Msin "Sine function" iw -\sin`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet Mcos "Cosine function" iw -\cos`!p smart_space(t[1], "(", loose=True)`$1`!p smart_space(t[1], ")", loose=True)` -endsnippet - -context "math()" -snippet Mtan "Tangent function" iw -\tan`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet Mcsc "Cosecant function" iw -\csc`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet Msec "Secant function" iw -\sec`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet Mcot "Cotangent function" iw -\cot`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -### Inverse trigonometric functions -context "math()" -snippet M!sin "Inverse sine keyword" iw -\arcsin`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet M!cos "Inverse cosine keyword" iw -\arccos`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet M!tan "Inverse tangent keyword" iw -\arctan`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet M!csc "Inverse cosecant keyword" iw -\arccsc`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet M!sec "Inverse secant keyword" iw -\arcsec`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet M!cot "Inverse cotangent" iw -\arccot`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -### Hyperbolic trigonometric functions -context "math()" -snippet Msinh "Hyperbolic sine" iw -\sinh`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet Mcosh "Hyperbolic cosine" iw -\cosh`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet Mtanh "Hyperbolic tangent" iw -\tanh`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet Mcsch "Hyperbolic cosecant" iw -\operatorname{csch}`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet Msech "Hyperbolic secant" iw -\operatorname{sech}`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet Mcoth "Hyperbolic cotangent" iw -\coth`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -### Inverse hyperbolic trigonometric functions -context "math()" -snippet M!sinh "Inverse hyperbolic sine" iw -\operatorname{arsinh}`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet M!cosh "Inverse hyperbolic cosine" iw -\operatorname{arcosh}`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet M!tanh "Inverse hyperbolic tangent" iw -\operatorname{artanh}`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet M!csch "Inverse hyperbolic cosecant" iw -\operatorname{arcsch}`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet M!sech "Inverse hyperbolic secant" iw -\operatorname{arsech}`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -context "math()" -snippet M!coth "Inverse hyperbolic cotangent" iw -\operatorname{arcoth}`!p snip.rv=smart_space(t[1], "(", loose=True)`$1`!p snip.rv=smart_space(t[1], ")", loose=True)` $0 -endsnippet - -## Common symbols found in geometry -snippet Gov "Overline" iw -\overline{$1} -endsnippet - -snippet ----- "Overline" iw -\overline{$1} -endsnippet - -snippet Gra "Right arrow" iw -\overrightarrow{$1} -endsnippet - -snippet ----> "Right arrow" iw -\overrightarrow{$1} -endsnippet - -snippet Gang "Angle symbol" iw -\angle -endsnippet - -snippet Gman "Measured angle symbol" iw -\measuredangle -endsnippet - -snippet Gtri "Triangle" iw -\triangle -endsnippet - -snippet Gpar "Parallel with" iw -\| -endsnippet - -snippet G!par "Not parallel with" iw -\nparallel -endsnippet - -snippet Gper "Perpendicular to" iw -\perp -endsnippet - -snippet G!per "Not perpendicular to" iw -\not\perp -endsnippet - -# Text formatting -snippet bf "Boldface text" iw -\textbf{$1}$0 -endsnippet - -snippet it "Italic text" iw -\emph{$1}$0 -endsnippet - -snippet tt "Teletype font" iw -\texttt{$1}$0 -endsnippet - -snippet ol "Enumerated list (ordered list)" iw -\begin{enumerate} - $1 -\end{enumerate} -$0 -endsnippet - -snippet ul "Itemized list (unordered list)" iw -\begin{itemize} - $1 -\end{itemize} -$0 -endsnippet - -snippet li "List item for the OL/UL lists" iw -\item{$1} -$0 -endsnippet - -context "not math()" -snippet a "URL links (with description)" iw -\href{${1:<url>}}{${2:<description>}} $0 -endsnippet - -context "not math()" -snippet url "Raw URL link" iw -\url{${1:<url>}} $0 -endsnippet - -snippet al "Reference links with label" iw -\autoref{${1:<label>}}$0 -endsnippet - -snippet code "Code listings with Minted package" iw -\begin{minted} - $3 -\end{minted} -$0 -endsnippet - -# This specifically needs the captions and minted with [newfloat] option -# Please see the below link for references: -# https://tex.stackexchange.com/a/254177 -snippet lcode "Code listings with label" iw -\begin{listing}[H] - \begin{minted}{${1:<language>}} - $2 - \end{minted} - `!p snip.rv=smart_space(t[3], "\caption{", loose=True)`$3`!p snip.rv=smart_space(t[3], "}", loose=True)` - \label{code!${4:$3}} -\end{listing} -endsnippet - -# Greek letters -context "math()" -snippet GAA "Uppercase Greek letter alpha" w -\Alpha -endsnippet - -context "math()" -snippet GAa "Lowercase Greek letter alpha" w -\alpha -endsnippet - -context "math()" -snippet GBB "Uppercase Greek letter beta" w -\Beta -endsnippet - -context "math()" -snippet GBb "Lowercase Greek letter beta" w -\beta -endsnippet - -context "math()" -snippet GCC "Uppercase Greek letter gamma" w -\Gamma -endsnippet - -context "math()" -snippet GCc "Lowercase Greek letter gamma" w -\gamma -endsnippet - -context "math()" -snippet GDD "Uppercase Greek letter delta" w -\Delta -endsnippet - -context "math()" -snippet GDd "Lowercase Greek letter delta" w -\delta -endsnippet - -context "math()" -snippet GEE "Uppercase Greek letter epsilon" w -\Epsilon -endsnippet - -context "math()" -snippet GEe "Lowercase Greek letter epsilon" w -\epsilon -endsnippet - -context "math()" -snippet GVEe "Variation Greek letter epsilon" w -\varepsilon -endsnippet - -context "math()" -snippet GTT "Uppercase Greek letter theta" w -\Theta -endsnippet - -context "math()" -snippet GTt "Lowercase Greek letter theta" w -\theta -endsnippet - -context "math()" -snippet GLL "Uppercase Greek letter lambda" w -\Lambda -endsnippet - -context "math()" -snippet GLl "Lowercase Greek letter lambda" w -\lambda -endsnippet - -context "math()" -snippet GPP "Uppercase Greek letter pi" w -\Pi -endsnippet - -context "math()" -snippet GPp "Lowercase Greek letter pi" w -\pi -endsnippet - -context "math()" -snippet GVPp "Variation Greek letter pi" w -\varpi -endsnippet - -context "math()" -snippet GSS "Uppercase Greek letter sigma" w -\Sigma -endsnippet - -context "math()" -snippet GSs "Lowercase Greek letter sigma" w -\sigma -endsnippet - -context "math()" -snippet GPH "Uppercase Greek letter phi" w -\Phi -endsnippet - -context "math()" -snippet GPh "Lowercase Greek letter phi" w -\phi -endsnippet - -context "math()" -snippet GVPh "Variation Greek letter phi" w -\varphi -endsnippet - -context "math()" -snippet GPS "Uppercase Greek letter psi" w -\Psi -endsnippet - -context "math()" -snippet GPs "Lowercase Greek letter psi" w -\psi -endsnippet - -context "math()" -snippet GOO "Uppercase Greek letter omega" w -\Omega -endsnippet - -context "math()" -snippet GOo "Lowercase Greek letter omega" w -\omega -endsnippet - -# Custom commands and environment (for my class notes) -# Do not use this if you don't have the following packages and -# does not have my custom document style file: -# * tcolorbox -# * xcolor -# * fontawesome -snippet dnote "Doc note admonition block" iw -\begin{-doc-note} - $1 -\end{-doc-note} -$0 -endsnippet - -snippet dinfo "Doc info admonition block" iw -\begin{-doc-info} - $1 -\end{-doc-info} -$0 -endsnippet - -snippet dtheo "Doc theorem block" iw -\begin{-doc-theorem}{${1:<Theorem title>}}{${2:<marker>}} - $3 -\end{-doc-theorem} -$0 -endsnippet - -snippet ddef "Doc definition block" iw -\begin{-doc-definition} -`!p snip.rv=smart_space(t[1], " \label{defn!", loose=True)`$1`!p snip.rv=smart_space(t[1], "}", loose=True)` - $2 -\end{-doc-definition} -$0 -endsnippet - -snippet dprop "Doc property block" iw -\begin{-doc-property} -`!p snip.rv=smart_space(t[1], " \label{prop!", loose=True)`$1`!p snip.rv=smart_space(t[1], "}", loose=True)` - $2 -\end{-doc-property} -$0 -endsnippet - -snippet dwarn "Doc warning callout block" iw -\begin{-doc-warning} - $1 -\end{-doc-warning} -$0 -endsnippet - -snippet dcrit "Doc critical callout block" iw -\begin{-doc-critical} - $1 -\end{-doc-critical} -$0 -endsnippet - -snippet dlist "Doc listings callout block" iw -\begin{-doc-listing}{${1:<title>}}{${2:<label name>}}{${3:<language>}} - $4 -\end{-doc-listing} -endsnippet -