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
This commit is contained in:
Scott Scoble 2026-05-12 21:59:08 -07:00
parent bcced4f9c9
commit 1e2cb21624
2 changed files with 34 additions and 2 deletions

View file

@ -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", "<leader>rn", vim.lsp.buf.rename, { buffer = buf })
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, { buffer = buf })
end
end,
})
'';
# === Pi config directory ===

View file

@ -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",
},
}
'';
}