From 94d2979dfea469c58859a9010c06110d12bf8a1a Mon Sep 17 00:00:00 2001 From: Zacharias-Brohn Date: Tue, 23 Sep 2025 23:38:54 +0200 Subject: [PATCH] lsp --- lua/config/lspconfig.lua | 59 ++++++++++++++++++++++++++-------------- lua/config/texlab.lua | 1 + lua/plugins/init.lua | 10 +++++++ 3 files changed, 49 insertions(+), 21 deletions(-) create mode 100644 lua/config/texlab.lua diff --git a/lua/config/lspconfig.lua b/lua/config/lspconfig.lua index 1c712cd..ca9222d 100644 --- a/lua/config/lspconfig.lua +++ b/lua/config/lspconfig.lua @@ -163,41 +163,58 @@ vim.diagnostic.config({ }, }) -local lspconfig = require "lspconfig" +local lspconfig = vim.lsp.config -lspconfig.zls.setup({ - capabilities = capabilities, - root_dir = lspconfig.util.root_pattern(".git", "build.zig", "zls.json"), +lspconfig("texlab", { + cmd = { "texlab" }, + filetypes = { "tex", "bib", "plaintex" }, + root_markers = { ".git", ".latexmkrc", "latexmkrc", ".texlabroot", "texlabroot", "Tectonic.toml" }, settings = { - zls = { - enable_inlay_hints = true, - enable_snippets = true, - warn_style = true, + texlab = { + rootDirectory = nil, + build = { + executable = "latexmk", + args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" }, + onSave = true, + forwardSearchAfter = true, + }, + forwardSearch = { + executable = "zathura", + args = { + "--synctex-editor-command", + [[ nvim-texlabconfig -file '%%%{input}' -line %%%{line} -server ]] .. vim.v.servername, + "--synctex-forward", + "%l:1:%f", + "%p", + }, + }, + chktex = { + onEdit = false, + onOpenAndSave = true, + }, + diagnosticsDelay = 300, + latexFormatter = "latexindent", + latexindent = { + ['local'] = nil, + modifyLineBreaks = false, + }, + bibtexFormatter = "texlab", + formatterLineLength = 80, }, }, }) --- lspconfig.zls.setup { --- cmd = { "zls" }, --- settings = { --- zls = { --- enable_build_on_save = true, --- semantic_tokens = "partial", --- }, --- }, --- } --- EXAMPLE +local lspenable = vim.lsp.enable local servers = { "html", "bashls", - "texlab", "pyright", "ts_ls", + "texlab", -- "jdtls", "sourcekit", } for _, server in ipairs(servers) do - lspconfig[server].setup { - } + lspenable(server) end diff --git a/lua/config/texlab.lua b/lua/config/texlab.lua new file mode 100644 index 0000000..bc49dc5 --- /dev/null +++ b/lua/config/texlab.lua @@ -0,0 +1 @@ +require("texlabconfig").setup({}) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index aa88b78..36642bd 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -248,4 +248,14 @@ return { require("config.chatgpt") end, }, + { + "elkowar/yuck.vim", + }, + { + "f3fora/nvim-texlabconfig", + config = function() + require("config.texlab") + end, + build = "go build", + }, }