nvim: configure latex formatting options and completion model

This commit is contained in:
2026-05-29 03:32:58 +02:00
parent 81aef85feb
commit 6966af3229
4 changed files with 32 additions and 1 deletions
+13
View File
@@ -9,3 +9,16 @@ vim.opt_local.spelllang = { "en_gb", "de_de", "fr" }
vim.opt_local.wrap = true
vim.opt_local.linebreak = true
vim.opt_local.textwidth = 0 -- don't hard-wrap LaTeX
-- Normalize display-math delimiters: $$ … $$ → \[ … \] on every save.
-- Uses a unique augroup per buffer to avoid double-registration on :edit.
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = 0,
group = vim.api.nvim_create_augroup("user_tex_normalize_math_" .. vim.api.nvim_get_current_buf(), { clear = true }),
callback = function()
local view = vim.fn.winsaveview()
vim.cmd([[silent! keeppatterns %s/\v\$\$(\_.{-})\$\$/\\[\1\\]/g]])
vim.fn.winrestview(view)
end,
})