Add proper LaTeX support (finally)

This commit is contained in:
salomaestro
2025-02-22 01:24:32 +01:00
parent 07cf759d98
commit bb87a70cb2
3 changed files with 46 additions and 7 deletions

View File

@@ -6,6 +6,7 @@ local options = {
-- python = { "isort", "black" },
python = { "isort", "ruff_fix", "ruff_format" },
yaml = { "prettier" },
latex = { "bibtex-tidy", "tex-fmt", lsp_format = "fallback" }
},
-- format_on_save = {

View File

@@ -5,7 +5,7 @@ local lspconfig = require "lspconfig"
nvlsp.defaults()
-- EXAMPLE
local servers = { "html", "cssls", "ruff", "jedi_language_server", "yls", "lua_ls" }
local servers = { "html", "cssls", "ruff", "jedi_language_server", "yls", "lua_ls", "texlab" }
-- lsps with default config
for _, lsp in ipairs(servers) do
@@ -16,12 +16,41 @@ for _, lsp in ipairs(servers) do
}
end
-- configuring single server, example: typescript
-- lspconfig.ts_ls.setup {
-- on_attach = nvlsp.on_attach,
-- on_init = nvlsp.on_init,
-- capabilities = nvlsp.capabilities,
-- }
-- lspconfig.texlab.setup({
-- settings = {
-- latex = {
-- build = {
-- executable = "latexmk",
-- args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
-- onSave = true,
-- },
-- },
-- },
-- })
-- Set up LTeX separately
lspconfig.ltex.setup {
on_init = nvlsp.on_init,
capabilities = nvlsp.capabilities,
on_attach = function(client, bufnr)
-- Run NvChad's on_attach for your usual LSP keymaps
nvlsp.on_attach(client, bufnr)
require("ltex_extra").setup {
load_langs = { "en-GB", "nb" },
init_check = true,
path = vim.fn.expand("~/.local/share/ltex"), -- where to store language dicts
}
end,
settings = {
ltex = {
language = "en-GB",
additionalLanguages = { "nb" },
},
},
}
lspconfig.ruff.setup({
init_options = {

View File

@@ -103,6 +103,10 @@ return {
"lua",
"python",
"markdown",
"latex",
},
highlight = {
enable = true,
},
},
},
@@ -258,4 +262,9 @@ return {
lazy = false,
},
{
"barreiroleo/ltex-extra.nvim",
ft = { "markdown", "tex" },
dependencies = { "neovim/nvim-lspconfig" },
},
}