summaryrefslogtreecommitdiff
path: root/lua/config/vimtex.lua
blob: e7c49989f49c2def6750d91efc171a1e2465ccf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
return function()
	-- Use Zathura as the PDF viewer
	vim.g.vimtex_view_method = "zathura"

	-- Compile using latexmk automatically
	vim.g.vimtex_compiler_method = "latexmk"
	vim.g.vimtex_compiler_latexmk = {
		build_dir = "build",       -- Keep files in a separate folder
		callback = 1,
		continuous = 1,            -- Automatically recompile on save
		executable = "latexmk",
		options = {
			"-pdf",
			"-interaction=nonstopmode",
			"-synctex=1",
		},
	}

	-- Auto hard-wrap at 80 columns for .tex files
	vim.api.nvim_create_autocmd("FileType", {
		pattern = "tex",
		callback = function()
			vim.opt_local.textwidth = 80
			vim.opt_local.formatoptions:append("t")
		end,
	})

	-- Optional: disable conceal for clearer LaTeX text
	vim.g.vimtex_syntax_conceal = {
		accents = 0,
		ligatures = 0,
		cites = 0,
		fancy = 0,
		spacing = 0,
		greek = 0,
		math_delimiters = 0,
		math_super_sub = 0,
	}
end