comment remap + typst support

This commit is contained in:
Ryan El Kochta 2025-04-28 00:41:50 -04:00
parent ac9c919527
commit f659db9c73
2 changed files with 52 additions and 0 deletions

View file

@ -5,3 +5,6 @@ vim.g.maplocalleader = "\\"
-- U as redo (not sure why this doesn't work by default?)
vim.api.nvim_set_keymap('n', 'U', '<C-r>', { noremap = true })
-- More obvious comment keybind
vim.api.nvim_set_keymap('n', '<leader>c', '<cmd>norm gcc<cr>', { desc = "Toggle comment", noremap = true })
vim.api.nvim_set_keymap('v', '<leader>c', '<cmd>norm gc<cr>', { desc = "Toggle comment", noremap = true })

View file

@ -0,0 +1,49 @@
local pdf_viewer = "zathura"
local open_pdf = function()
local filepath = vim.api.nvim_buf_get_name(0)
if not filepath:match("%.typ$") then
return
end
local pdf_path = filepath:gsub("%.typ$", ".pdf")
vim.uv.spawn(pdf_viewer, { args = { pdf_path } })
end
vim.api.nvim_create_autocmd("FileType", {
pattern = "typst",
callback = function()
-- enable word wrap
vim.opt_local.wrap = true
vim.opt_local.linebreak = true
-- create localleader keybindings
local buf = vim.api.nvim_get_current_buf()
vim.keymap.set("n",
"<localleader>ll",
open_pdf,
{ desc = "Open typst output PDF",
buffer = buf,
noremap = false
})
end,
})
return {
{
"VonHeikemen/lsp-zero.nvim",
opts = {
my_servers = {
tinymist = {
settings = {
formatterMode = "typstyle",
exportPdf = "onSave",
semanticTokens = "disable",
compileStatus = "enable",
completion = {
triggerOnSnippetPlaceholders = false,
},
},
},
},
},
},
}