Replies: 1 comment 1 reply
-
|
At present, the following in vim.pack.add({ "lervag/vimtex" })
vim.g.vimtex_view_method = 'zathura'
vim.g.vimtex_syntax_conceal_disable = 1
vim.g.vimtex_indent_enabled = 0
vim.g.vimtex_indent_bib_enabled = 0
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*.tex",
callback = function()
local file = vim.fn.expand("%:p")
vim.fn.system({
"latexindent",
"-c=/tmp/",
"-w",
file,
"-y=defaultIndent:' '"
})
vim.cmd("edit!") -- reload updated file
end,
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
Is it possible to have VimTeX call latexindent (https://github.com/cmhughes/latexindent.pl) for formatting?
I work in VSCode as well as VimTeX and VSCode plugin provides for the following settings.json options to have the tex file formatted:
If both use the same indenting tool, it would help to avoid spurious diffs in git version controlling.
Thanks!
Edited to add: The following is the sequence of commands emitted to format the file under VSCode plugin on saving a tex file
Is there a way to achieve the same effect on save in VimTeX?
I observe that the documentation does mention latexindent.pl but I was not able to find an autocommand example which incorporates latexindent. Hence this OP.
Beta Was this translation helpful? Give feedback.
All reactions