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: