Add typst

This commit is contained in:
sfigato 2024-03-20 00:45:35 +01:00
parent d68a536a91
commit 20e00625b8
Signed by: blallo
GPG Key ID: C530464EEDCF489A
3 changed files with 48 additions and 0 deletions

View File

@ -33,6 +33,34 @@ if not configs.elixirls then
}
end
-- typst-lsp
if not configs.typst_lsp then
configs.typst_lsp = {
default_config = {
cmd = { 'typst-lsp' },
filetypes = { 'typst' },
single_file_support = true,
root_dir = function(fname)
return nvim_lsp.util.find_git_ancestor(fname)
end,
},
docs = {
description = [[
https://github.com/nvarner/typst-lsp
Language server for Typst.
]],
},
}
end
require 'lspconfig'.typst_lsp.setup {
settings = {
exportPdf = "onSave",
}
}
-- keybindings
local on_attach = function(client, bufrn)
@ -90,6 +118,7 @@ local servers = {
-- 'denols',
'clangd',
'zls',
'typst-lsp',
}
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {

View File

@ -40,3 +40,18 @@ parser_config.hare = {
}
vim.treesitter.language.register('hare', 'hare')
-- typst syntax
-- parser_config.typst = {
-- install_info = {
-- url = "~/code/typst/tree-sitter-typst", -- local path or git repo
-- files = {"src/parser.c", "src/scanner.cc"}, -- note that some parsers also require src/scanner.c or src/scanner.cc
-- -- optional entries:
-- -- branch = "main", -- default branch in case of git repo if different from master
-- generate_requires_npm = true, -- if stand-alone parser without npm dependencies
-- requires_generate_from_grammar = true, -- if folder contains pre-generated src/parser.c
-- },
-- filetype = "typ", -- if filetype does not match the parser name
-- }
--
-- vim.treesitter.language.register('typst', 'typ')

View File

@ -148,6 +148,10 @@ local function init()
-- RFC browser
use 'mhinz/vim-rfc'
-- typst
use 'kaarmu/typst.vim'
use 'nvarner/typst-lsp'
end
local plugins = setmetatable({}, {