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", "black" },
python = { "isort", "ruff_fix", "ruff_format" }, python = { "isort", "ruff_fix", "ruff_format" },
yaml = { "prettier" }, yaml = { "prettier" },
latex = { "bibtex-tidy", "tex-fmt", lsp_format = "fallback" }
}, },
-- format_on_save = { -- format_on_save = {

View File

@@ -5,7 +5,7 @@ local lspconfig = require "lspconfig"
nvlsp.defaults() nvlsp.defaults()
-- EXAMPLE -- 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 -- lsps with default config
for _, lsp in ipairs(servers) do for _, lsp in ipairs(servers) do
@@ -16,12 +16,41 @@ for _, lsp in ipairs(servers) do
} }
end end
-- configuring single server, example: typescript -- lspconfig.texlab.setup({
-- lspconfig.ts_ls.setup { -- settings = {
-- on_attach = nvlsp.on_attach, -- latex = {
-- on_init = nvlsp.on_init, -- build = {
-- capabilities = nvlsp.capabilities, -- 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({ lspconfig.ruff.setup({
init_options = { init_options = {

View File

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