Feat: add vimtex to nivm

This commit is contained in:
Bertrand Benjamin 2024-12-24 10:58:39 +01:00
parent d812c32e37
commit cbe9a6c55c
3 changed files with 69 additions and 12 deletions

View File

@ -29,7 +29,7 @@ return {
vim.keymap.set({ "n", "v" }, "<leader>mp", function()
conform.format({
lsp_fallback = true,
async = false,
async = true,
timeout_ms = 500,
})
end, { desc = "Format file or range (in visual mode)" })

View File

@ -1,14 +1,44 @@
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function ()
local configs = require("nvim-treesitter.configs")
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
local configs = require("nvim-treesitter.configs")
configs.setup({
ensure_installed = { "lua", "vim", "vimdoc", "javascript", "html", "python", "dockerfile", "latex", "yaml", "regex", "bash", "markdown", "markdown_inline" },
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
})
end
configs.setup({
ensure_installed = {
"lua",
"vim",
"vimdoc",
"javascript",
"html",
"python",
"dockerfile",
"latex",
"yaml",
"regex",
"bash",
"markdown",
"markdown_inline",
},
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
})
end,
opts = function(_, opts)
vim.treesitter.language.register("markdown", "mdx")
-- vim.list_extend(opts.highlight.disable, { "tsx" })
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, {
"bibtex",
"latex",
-- you can add more here
})
end
if type(opts.highlight.disable) == "table" then
vim.list_extend(opts.highlight.disable, { "latex", "bibtex" })
else
opts.highlight.disable = { "latex", "bibtex" }
end
end,
}

View File

@ -0,0 +1,27 @@
return {
{
"lervag/vimtex",
lazy = false, -- lazy-loading will disable inverse search
config = function()
vim.api.nvim_create_autocmd({ "FileType" }, {
group = vim.api.nvim_create_augroup("lazyvim_vimtex_conceal", { clear = true }),
pattern = { "bib", "tex" },
callback = function()
vim.wo.conceallevel = 0
end,
})
vim.g.vimtex_mappings_disable = { ["n"] = { "K" } } -- disable `K` as it conflicts with LSP hover
vim.g.vimtex_quickfix_method = vim.fn.executable("pplatex") == 1 and "pplatex" or "latexlog"
vim.g.vimtex_view_method = "zathura" -- <== macos specific, you can use zathura or sumatra or something else.
vim.g.vimtex_view_skim_sync = 1
vim.g.vimtex_view_skim_activate = 1
vim.g.vimtex_view_skim_reading_bar = 1
vim.g.vimtex_compiler_latexmk = {
aux_dir = "./aux",
out_dir = "./out",
}
end,
},
}