From 4201491bb3ff70e2432560f7d661dfb263d8fc02 Mon Sep 17 00:00:00 2001 From: Mayrixon Date: Tue, 18 Jul 2023 00:59:14 +0100 Subject: [PATCH] feat(lang): add tex support --- lua/lazyvim/plugins/extras/lang/tex.lua | 61 +++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/tex.lua diff --git a/lua/lazyvim/plugins/extras/lang/tex.lua b/lua/lazyvim/plugins/extras/lang/tex.lua new file mode 100644 index 00000000..9cd4e823 --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/tex.lua @@ -0,0 +1,61 @@ +return { + { + "folke/which-key.nvim", + opts = { + defaults = { + ["l"] = { name = "+vimtex" }, + }, + }, + }, + + -- Add BibTeX/LaTeX to treesitter + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "bibtex", "latex" }) + end + if type(opts.highlight.disable) == "table" then + vim.list_extend(opts.highlight.disable, { "latex" }) + else + opts.highlight.disable = { "latex" } + end + end, + }, + + { + "lervag/vimtex", + version = "*", + ft = { "bib", "tex" }, + keys = { + { "ld", "VimtexDocPackage", desc = "Open Documentation" }, + }, + config = function() + vim.opt.conceallevel = 2 + vim.g.vimtex_complete_enabled = 0 -- use texlab for completion + vim.g.vimtex_mappings_disable = { ["n"] = { "K" } } -- disable `K` as the confilict to LSP hover + vim.g.vimtex_quickfix_method = vim.fn.executable("pplatex") == 1 and "pplatex" or "latexlog" + + vim.g.vimtex_view_method = vim.fn.has("mac") == 1 and "skim" or "zathura" + end, + }, + + -- Correctly setup lspconfig for LaTeX 🚀 + { + "neovim/nvim-lspconfig", + optional = true, + opts = { + servers = { + texlab = { + settings = { + texlab = { + chktex = { + onOpenAndSave = true, + }, + }, + }, + }, + }, + }, + }, +}