Add Typst

This commit is contained in:
Thomas Avé 2024-02-26 23:25:15 +01:00
parent fe95457735
commit e473cb93a1
5 changed files with 25 additions and 8 deletions

View File

@ -4,7 +4,5 @@ require('mappings')
require('teaching') require('teaching')
vim.api.nvim_create_autocmd("FileType", { pattern = "make", command = [[set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab]] }) vim.api.nvim_create_autocmd("FileType", { pattern = "make", command = [[set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab]] })
vim.api.nvim_create_autocmd("FileType", { pattern = "vimwiki", command = [[setlocal shiftwidth=2 softtabstop=2 expandtab]] })
vim.api.nvim_create_autocmd("FileType", { pattern = "vimwiki", command = [[setlocal filetype=markdown]] })
vim.api.nvim_create_autocmd("FileType", { pattern = "javascript", command = [[setlocal shiftwidth=2 softtabstop=2 expandtab]] }) vim.api.nvim_create_autocmd("FileType", { pattern = "javascript", command = [[setlocal shiftwidth=2 softtabstop=2 expandtab]] })
vim.api.nvim_create_autocmd("FileType", { pattern = "vue", command = [[setlocal shiftwidth=2 softtabstop=2 expandtab]] }) vim.api.nvim_create_autocmd("FileType", { pattern = "vue", command = [[setlocal shiftwidth=2 softtabstop=2 expandtab]] })

View File

@ -11,6 +11,6 @@ return {
'neovim/nvim-lspconfig' 'neovim/nvim-lspconfig'
}, },
opts = { opts = {
ensure_installed = { "pyright", "texlab", "clangd", "bashls", "cmake", "jsonls", "tsserver", "vuels", "dockerls", "vimls", "html", "yamlls", "cssls", "lua_ls", "ltex", "gopls", "rust_analyzer", "jdtls", "emmet_ls", "ruff_lsp", "csharp_ls" }, ensure_installed = { "pyright", "texlab", "clangd", "bashls", "cmake", "jsonls", "tsserver", "vuels", "dockerls", "vimls", "html", "yamlls", "cssls", "lua_ls", "ltex", "gopls", "rust_analyzer", "jdtls", "emmet_ls", "ruff_lsp", "csharp_ls", "typst_lsp" },
} }
} }

View File

@ -151,6 +151,10 @@ return {
capabilities = capabilities capabilities = capabilities
} }
require('lspconfig').typst_lsp.setup {
capabilities = capabilities
}
require('lspconfig').cmake.setup { require('lspconfig').cmake.setup {
capabilities = capabilities capabilities = capabilities
} }
@ -256,10 +260,11 @@ return {
end, end,
settings = { settings = {
ltex = { ltex = {
enabled = true, enabled = { "bibtex", "gitcommit", "markdown", "org", "tex", "restructuredtext", "rsweave", "latex", "quarto", "rmd", "context", "html", "xhtml", "typst" },
language = "en-GB" language = "en-GB"
} },
} },
filetypes = { "bib", "gitcommit", "markdown", "org", "plaintex", "rst", "rnoweb", "tex", "pandoc", "quarto", "rmd", "context", "html", "xhtml" , "typst"}
} }
vim.diagnostic.config({ vim.diagnostic.config({

View File

@ -1,6 +1,9 @@
return { return {
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
dependencies = {"luckasRanarison/tree-sitter-hyprlang"}, dependencies = {
"https://github.com/TheZoq2/tree-sitter-typst",
"luckasRanarison/tree-sitter-hyprlang"
},
build = ":TSUpdate", build = ":TSUpdate",
opts = { opts = {
ensure_installed = { "cpp", "c", "lua", "vim", "dockerfile", "python", "java", "cmake", "diff", "gitcommit", "html", "css", "javascript", "json", "rust", "sql", "yaml", "markdown", "markdown_inline" }, ensure_installed = { "cpp", "c", "lua", "vim", "dockerfile", "python", "java", "cmake", "diff", "gitcommit", "html", "css", "javascript", "json", "rust", "sql", "yaml", "markdown", "markdown_inline" },
@ -25,8 +28,17 @@ return {
}, },
config = function (_, opts) config = function (_, opts)
require("nvim-treesitter.configs").setup(opts) require("nvim-treesitter.configs").setup(opts)
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
require'nvim-treesitter.install'.prefer_git = true
parser_config.typst = {
install_info = {
url = "https://github.com/frozolotl/tree-sitter-typst.git", -- local path or git repo
files = {"src/parser.c", "src/scanner.cc"},
},
filetype = "typst", -- if filetype does not match the parser name
}
vim.filetype.add({ vim.filetype.add({
pattern = { [".*/hyprland%.conf"] = "hyprlang" }, pattern = { [".*.typ"] = "typst" },
}) })
end end
} }

View File

@ -4,3 +4,5 @@ OpenSwarm
Lumentis Lumentis
stochasticity stochasticity
Feywild Feywild
ECML
theshold-based