diff --git a/vim/own-snippets/all.snippets b/vim/own-snippets/all.snippets new file mode 100644 index 0000000..f3d22fb --- /dev/null +++ b/vim/own-snippets/all.snippets @@ -0,0 +1,31 @@ +global !p +from datetime import datetime, timedelta + +def relative_date(days): + 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)) +snip.rv = reldate.strftime("%F") +` +endsnippet + +snippet today "Prints out today's date in ISO format" i +`!p +from datetime import datetime + +snip.rv = datetime.today().strftime("%F") +` +endsnippet + +snippet sign "Quick signature" i +${1:Sincerely,} +${2:Gabriel Arazas} +$0 +endsnippet + diff --git a/vim/own-snippets/snippets.snippets b/vim/own-snippets/snippets.snippets new file mode 100644 index 0000000..54afb72 --- /dev/null +++ b/vim/own-snippets/snippets.snippets @@ -0,0 +1,14 @@ +snippet usnip "A working snippet for creating UltiSnips snippets" ib +`!p snip.rv = "snippet"` ${1:} ${2:} ${3:} +$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/vim/own-snippets/tex.snippets b/vim/own-snippets/tex.snippets new file mode 100644 index 0000000..f62c0a6 --- /dev/null +++ b/vim/own-snippets/tex.snippets @@ -0,0 +1,868 @@ +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] + +def smart_space(next_str, auto_str=" "): + if next_str and next_str[0] in [",", ".", "-", "!", "?", " "]: + snip.rv = auto_str + else: + snip.rv = "" +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{chngcntr} +\usepackage{import} +\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{ch:$1} +$0 +endsnippet + +snippet section "Section tag" bi +\section{$1} +\label{sec:$1} +$0 +endsnippet + +snippet subsec "Subsection tag" bi +\subsection{$1} +\label{subsec:$1} +$0 +endsnippet + +# Common commands +snippet pack "Use package command" i +\usepackage`!p smart_space(t[2], "[")`$2`!p smart_space(t[2], "]")`{$1} +$0 +endsnippet + +snippet letter "Make at letter block" i +\makeatletter +$1 +\makeatother +$0 +endsnippet + +snippet label "Create a label" i +\label{$1} +$0 +endsnippet + +snippet ref "Create a reference for a label" i +\ref{${1: