diff --git a/nvim/lua/lsp.lua b/nvim/lua/lsp.lua index 47a0403..8076a8e 100644 --- a/nvim/lua/lsp.lua +++ b/nvim/lua/lsp.lua @@ -226,15 +226,28 @@ vim.cmd [[ augroup END ]] -vim.api.nvim_create_autocmd('FileType', { +vim.api.nvim_create_autocmd({ 'FileType', +}, { pattern = "*", callback = function() - if vim.bo.filetype ~= "plaintex" and vim.bo.filetype ~= "tex" and vim.bo.filetype ~= "latex" then + if vim.bo.filetype ~= "plaintex" and vim.bo.filetype ~= "tex" and vim.bo.filetype ~= "latex" and + vim.bo.filetype ~= "qf" and vim.bo.filetype ~= "bib" and vim.bo.filetype ~= "" and vim.bo.filetype ~= "pdf" + and vim.bo.filetype ~= "conf" then vim.cmd [[ :COQnow -s ]] end end }) +-- vim.api.nvim_create_autocmd({ 'FileType', 'BufRead', 'BufReadPre', 'BufReadPost', 'BufWrite', 'BufWritePre', +-- 'BufWritePost' }, { +-- pattern = "*", +-- callback = function() +-- if vim.bo.filetype ~= "plaintex" and vim.bo.filetype ~= "tex" and vim.bo.filetype ~= "latex" then +-- vim.cmd [[ :COQnow -s ]] +-- end +-- end +-- }) + -- vim.cmd [[ -- augroup disabletexlsp -- autocmd! diff --git a/nvim/ultisnips/tex.snippets b/nvim/ultisnips/tex.snippets index a647259..1c0346c 100644 --- a/nvim/ultisnips/tex.snippets +++ b/nvim/ultisnips/tex.snippets @@ -1,6 +1,13 @@ global !p + +# thanks to gilles castel + def math(): return vim.eval('vimtex#syntax#in_mathzone()') == '1' + +def env(name): + [x,y] = vim.eval("vimtex#env#is_inside('" + name + "')") + return x != '0' and y != '0' endglobal snippet beg "begin{} / end{}" bA @@ -26,4 +33,82 @@ snippet dm "Display Math" wA .\] $0 endsnippet +snippet sc "Code" wA +\texttt{${1}}`!p +if t[2] and t[2][0] not in [',', '.', '?', '-', ' ']: + snip.rv = ' ' +else: + snip.rv = '' +`$2 +endsnippet + +snippet dc "Display Code" wA +\begin{lstlisting}[$1] +$2 +\end{lstlisting} $0 +endsnippet + +snippet pac "Package" b +\usepackage[$1]{$2}$0 +endsnippet + +snippet template "Basic template" b +\documentclass[$1]{$2} + +$3 + +\begin{document} + $0 +\end{document} +endsnippet + +snippet item "Itemize" bA +\begin{itemize} + \item $0 +\end{itemize} +endsnippet + +snippet enum "Enumerate" bA +\begin{enumerate} + \item $0 +\end{enumerate} +endsnippet + +snippet alph "Alphabet Enumerate" bA +\begin{enumerate}[label= (\alph*)] + \item $1 +\end{enumerate} $0 +endsnippet + +snippet desc "Description" bA +\begin{description} + \item[$1] $2 +\end{description} $0 +endsnippet + +snippet table "Table" b +\begin{table}[${1:htpb}] + \centering + \caption{${2:caption}} + \label{tab:${3:label}} + \begin{tabular}{${5:c}} + $6${5/((?<=.)c|l|r)|./(?1: & )/g} + \end{tabular} +\end{table} $0 +endsnippet + + + +snippet ltable "Long table" b +\begin{longtable}{${1:|p{5cm}|p{10cm}|}} + \hline + $2 + \hline +\end{longtable} $0 +endsnippet + +snippet --- "hline" iA +\hline +endsnippet + diff --git a/scripts/timereset b/scripts/timereset new file mode 100755 index 0000000..a1d1568 --- /dev/null +++ b/scripts/timereset @@ -0,0 +1,2 @@ +#!/bin/bash +sudo systemctl restart systemd-timesyncd.service diff --git a/tex/english.cls b/tex/english.cls index 3f671e2..dbd47a1 100644 --- a/tex/english.cls +++ b/tex/english.cls @@ -7,6 +7,7 @@ \RequirePackage{setspace} \RequirePackage{geometry} \RequirePackage{indentfirst} +\RequirePackage{longtable} \doublespacing \geometry{top=20mm,bottom=20mm} diff --git a/tex/mathhw.cls b/tex/mathhw.cls index a117642..5d9fb0d 100644 --- a/tex/mathhw.cls +++ b/tex/mathhw.cls @@ -1,5 +1,5 @@ \ProvidesClass{mathhw} -\LoadClass[fontsize=9pt]{scrartcl} +\LoadClass[fontsize=9pt, paper=a4, pagesize, DIV=calc]{scrartcl} \RequirePackage[utf8]{inputenc} \RequirePackage{amsfonts, amsmath, amssymb, amsthm}