nvim: configure latex formatting options and completion model
This commit is contained in:
@@ -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,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user