typst: textwidth aware formatting

This commit is contained in:
Primrose 2025-08-01 15:10:45 +02:00
parent 4cc165fd7f
commit 8c729cea42
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -6,8 +6,9 @@ local once = require("once")
once.test_and_load("ft_typst", function() once.test_and_load("ft_typst", function()
vim.keymap.set("n", "<leader>f", function() vim.keymap.set("n", "<leader>f", function()
local tw = vim.bo.textwidth
local saved = vim.fn.winsaveview() local saved = vim.fn.winsaveview()
vim.cmd([[silent exec "%!typstyle -c 100"]]) vim.cmd('silent exec "%!typstyle -c ' .. tostring(tw) .. ' "')
vim.fn.winrestview(saved) vim.fn.winrestview(saved)
end, { desc = "ft(typst): Format with typstyle" }) end, { desc = "ft(typst): Format with typstyle" })