From f659db9c73e4a5d5ac9b22122aafc9b8d3cc962c Mon Sep 17 00:00:00 2001 From: Ryan El Kochta Date: Mon, 28 Apr 2025 00:41:50 -0400 Subject: [PATCH] comment remap + typst support --- lua/core/remap.lua | 3 +++ lua/plugins/lang/typst.lua | 49 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 lua/plugins/lang/typst.lua diff --git a/lua/core/remap.lua b/lua/core/remap.lua index 0e06f07..0fa9f9d 100644 --- a/lua/core/remap.lua +++ b/lua/core/remap.lua @@ -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', '', { noremap = true }) +-- More obvious comment keybind +vim.api.nvim_set_keymap('n', 'c', 'norm gcc', { desc = "Toggle comment", noremap = true }) +vim.api.nvim_set_keymap('v', 'c', 'norm gc', { desc = "Toggle comment", noremap = true }) diff --git a/lua/plugins/lang/typst.lua b/lua/plugins/lang/typst.lua new file mode 100644 index 0000000..2aaf442 --- /dev/null +++ b/lua/plugins/lang/typst.lua @@ -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", + "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, + }, + }, + }, + }, + }, + }, +}