Impoved defdoc snippet

This commit is contained in:
Pavel Korytov 2019-11-21 08:25:19 +03:00
parent 87211c3e50
commit c217e480bf
4 changed files with 74 additions and 15 deletions

View file

@ -233,6 +233,15 @@ nnoremap ` :call SubTerminal()<CR>
" }}}
" Git diff stats {{{
function! Gstats()
execute '!git diff --stat'
endfunction
command! Gstats call Gstats()
" }}}
"Indent & folding stuff {{{
set tabstop=4
set shiftwidth=4

View file

@ -0,0 +1 @@
priority -50

View file

@ -1,8 +1,35 @@
priority -50
global !p
import glob
PRIORITIES = {
'generalPreamble': 0,
'Locale': 1,
'BibTex': 2,
}
def get_styles(folder):
styles = [file[:-4] for file in glob.glob(f'{folder}/*.sty')]
priorities = [1] * len(styles)
for i, filename in enumerate(styles):
for name, priority in PRIORITIES.items():
if name in filename:
priorities[i] = priority
priorities, styles = zip(*sorted(zip(priorities, styles)))
return styles
endglobal
snippet defdoc "Default document template"
\documentclass[a4paper, 14pt]{extarticle}
\usepackage{./styles/generalPreamble}
`!p
res = ""
for style in get_styles("./styles"):
res += "\\usepackage{" + style + "}\n"
snip.rv = res
`
\begin{document}
$0
@ -14,32 +41,54 @@ snippet etutitle "ETU default report title"
\centering
{\bfseries
\uppercase{
Минобрнауки России \\
Санкт-Петербургский государственный \\
Электротехнический университет \\
\enquote{ЛЭТИ} им. В.И.Ульянова (Ленина)\\
Минобрнауки России \\\\
Санкт-Петербургский государственный \\\\
Электротехнический университет \\\\
\enquote{ЛЭТИ} им. В.И.Ульянова (Ленина)\\\\
}
Кафедра ${1:МО ЭВМ}
\vspace{\fill}
\uppercase{${2:Отчёт}}
по ${3:лабораторной работе} ${4:№1}
по дисциплине \enquote{$5} \\
\uppercase{${2:Отчёт}} \\\\
по ${3:лабораторной работе} ${4:№1} \\\\
по дисциплине \enquote{$5} \\\\
Тема: $6
}
\vspace{\fill}
\begin{tabularx}{0.8\textwidth}{l X c r}
Студент гр. 6304 & & \underline{\hspace{3cm}} & Корытов П.В.\\
Студент гр. 6304 & & \underline{\hspace{3cm}} & Корытов П.В.\\\\
Преподаватель & & \underline{\hspace{3cm}} & $7
\end{tabularx}
\vspace{1cm}
Санкт-Петербург \\
Санкт-Петербург \\\\
\the\year{}
\end{titlepage}
$0
endsnippet
snippet fhdr "My default fancy header"
\usepackage{fancyhdr}
\pagestyle{fancy}
\newcommand{\theversion}{${1:1.0}}
\fancyhead[L]{
\begin{tabular}{ll}
\textit{${2:Project}} \\\\
${3:Документ}
\end{tabular}
}
\fancyhead[R]{
\begin{tabular}{ll}
Версия: & \theversion{} \\\\
Дата: & \today{}
\end{tabular}
}
endsnippet
# vim:ft=snippets:

View file

@ -49,8 +49,12 @@ snippet lfig
$0
endsnippet
snippet ' -' "---" wrA
--- $0
endsnippet
snippet vec "vector sign"
\vec{$0}
\vec{$1} $0
endsnippet
snippet suml "\sum\limits"
@ -80,10 +84,6 @@ snippet fig "Default figure here"
$0
endsnippet
snippet $$ "$ $"
\$ $1 \$ $0
endsnippet
snippet subfig "Figure with subfigures"
\begin{figure}[h]
\centering