nvim: extra typst stuff for lectures
This commit is contained in:
parent
5371170dcf
commit
b33d4bea7f
@ -3,6 +3,7 @@ Plug 'kaarmu/typst.vim'
|
||||
|
||||
" edit figure in Inkscape
|
||||
function EditFig()
|
||||
" expands filename under cursor
|
||||
let figure_fname = expand('<cfile>')
|
||||
exec "silent !typst-figure " .. figure_fname
|
||||
vsp
|
||||
@ -12,6 +13,13 @@ endfunc
|
||||
|
||||
nnoremap <silent><leader>ff :call EditFig()<cr>
|
||||
|
||||
" imports latest screenshot into a figure
|
||||
function ScreenshotFig()
|
||||
call system("mkdir -p " . expand("<cfile>:h"))
|
||||
call system("ffmpeg -y -i ~/med/screen/latest.png " . expand("<cfile>"))
|
||||
endf
|
||||
nnoremap <silent><leader>fs :call ScreenshotFig()<cr>
|
||||
|
||||
" compile typst doc on write
|
||||
function TypstWatch()
|
||||
vsp
|
||||
|
@ -1,5 +1,5 @@
|
||||
snippet problem "template for problem notes" bi
|
||||
#import "../templates/problems.typ": template, source_code, status
|
||||
#import "../templates/sfd.typ": template
|
||||
#show: template.with(
|
||||
problem_url: "$1",
|
||||
title: "$2",
|
||||
@ -8,6 +8,15 @@ snippet problem "template for problem notes" bi
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet sfd "template for lecture notes" bi
|
||||
#import "../../templates/problems.typ": template, source_code, status
|
||||
#show: template.with(
|
||||
lecture_url: "$1",
|
||||
title: "$2",
|
||||
)
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet contest "template for contest problems" bi
|
||||
#import "../../templates/contest.typ": template, source_code, status
|
||||
#show: template.with(
|
||||
@ -61,3 +70,10 @@ snippet fig "create new figure" bi
|
||||
caption: [$2],
|
||||
) <$1>
|
||||
endsnippet
|
||||
|
||||
snippet figp "create new image figure" bi
|
||||
#figure(
|
||||
image("fig/`!v expand("%:r")`/$1.jpg"),
|
||||
caption: [$2],
|
||||
) <$1>
|
||||
endsnippet
|
||||
|
Loading…
Reference in New Issue
Block a user