mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
36 lines
952 B
Lua
36 lines
952 B
Lua
vim.bo.shiftwidth = 2
|
|
vim.bo.tabstop = 2
|
|
vim.bo.textwidth = 100
|
|
|
|
vim.keymap.set("n", "<leader>f", function()
|
|
local saved = vim.fn.winsaveview()
|
|
vim.cmd([[silent exec "%!typstyle -c 100"]])
|
|
vim.fn.winrestview(saved)
|
|
end, { desc = "ft(typst): Format with typstyle" })
|
|
|
|
do
|
|
local luasnip = require("luasnip")
|
|
local s = luasnip.snippet
|
|
local t = luasnip.text_node
|
|
local cr = function() return t { "", "" } end
|
|
local i = luasnip.insert_node
|
|
local f = luasnip.function_node
|
|
|
|
local function show_date_typst_entry() return os.date('"%Y-%m-%d %H:%M:%S"') end
|
|
luasnip.add_snippets("typst", {
|
|
s("entry", {
|
|
t("#entry("),
|
|
f(show_date_typst_entry),
|
|
t { ")[", "" },
|
|
t(" "),
|
|
i(0),
|
|
t { "", "]" },
|
|
}),
|
|
s("lang", {
|
|
t('#set text(lang: "'),
|
|
i(0),
|
|
t('")'),
|
|
cr(),
|
|
}),
|
|
})
|
|
end
|