From 1e2cb21624f92e2d971b0bd1773d8d01cd2a7e28 Mon Sep 17 00:00:00 2001 From: Scott Scoble Date: Tue, 12 May 2026 21:59:08 -0700 Subject: [PATCH] typst: add typstudio + neovim LSP config - typstudio: standalone Typst editor with built-in live preview - neovim: auto-loads tinymist LSP on .typ files (hover, goto-def, rename, code actions) - keep-alive: tinymist already provides typst-lsp protocol --- home/sscoble.nix | 18 +++++++++++++++++- home/wgu.nix | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/home/sscoble.nix b/home/sscoble.nix index 6be3203..4304520 100644 --- a/home/sscoble.nix +++ b/home/sscoble.nix @@ -67,7 +67,7 @@ }; }; - # === Neovim config === + # === Neovim config (with LSP support) === home.file.".config/nvim/init.lua".text = '' vim.opt.number = true vim.opt.relativenumber = true @@ -89,6 +89,22 @@ vim.opt.updatetime = 50 vim.opt.colorcolumn = "100" vim.g.mapleader = " " + + -- LSP: load per-filetype configs + vim.api.nvim_create_autocmd("FileType", { + pattern = "typst", + callback = function() + local ok, config = pcall(dofile, vim.fn.stdpath("config") .. "/lua/lsp/typst.lua") + if ok and config then + vim.lsp.start(config, { bufnr = 0 }) + local buf = vim.api.nvim_get_current_buf() + vim.keymap.set("n", "K", vim.lsp.buf.hover, { buffer = buf }) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, { buffer = buf }) + vim.keymap.set("n", "rn", vim.lsp.buf.rename, { buffer = buf }) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, { buffer = buf }) + end + end, + }) ''; # === Pi config directory === diff --git a/home/wgu.nix b/home/wgu.nix index 13b88d4..226ca0c 100644 --- a/home/wgu.nix +++ b/home/wgu.nix @@ -18,7 +18,8 @@ # Document preparation typst - tinymist # Typst LSP for VS Code + typstudio # Standalone Typst editor with live preview + tinymist # LSP (tinymist binary speaks typst-lsp protocol) pandoc # Password manager (LastPass has no Linux native client — use Bitwarden) @@ -33,4 +34,19 @@ "editor.fontSize" = 14; "workbench.colorTheme" = "Catppuccin Mocha"; }; + + # === Neovim LSP for Typst === + # Tinymist binary speaks the typst-lsp protocol — plug into nvim-lspconfig + home.file.".config/nvim/lua/lsp/typst.lua".text = '' + return { + cmd = { "${pkgs.tinymist}/bin/tinymist" }, + filetypes = { "typst" }, + root_markers = { ".git", "flake.nix" }, + single_file_support = true, + settings = { + exportPdf = "onSave", + outputPath = "$root/out/$name.pdf", + }, + } + ''; }