diff options
| author | WriterV2 <primary-v2@protonmail.com> | 2026-04-03 22:46:48 +0200 |
|---|---|---|
| committer | WriterV2 <primary-v2@protonmail.com> | 2026-04-03 22:46:48 +0200 |
| commit | a1ec4771740d321df4480e8a7224fa10b59f0569 (patch) | |
| tree | 5e97e8ced79b4fea057fab6e76f80849c053e401 /.config/nvim/lua/writing_config.lua | |
Update repo with git init directly in home dir
Diffstat (limited to '.config/nvim/lua/writing_config.lua')
| -rw-r--r-- | .config/nvim/lua/writing_config.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/.config/nvim/lua/writing_config.lua b/.config/nvim/lua/writing_config.lua new file mode 100644 index 0000000..6380868 --- /dev/null +++ b/.config/nvim/lua/writing_config.lua @@ -0,0 +1,18 @@ +vim.api.nvim_create_autocmd("BufWritePost", { + pattern = "*.tex", + callback = function() + -- compile tex file to pdf with pdflatex on save + if vim.fn.executable('pdflatex') == 1 then + vim.cmd("execute '!pdflatex ' . expand('%:p')") + else + print("pdflatex is not installed") + end + + -- compile tex file to html with pandoc on save + if vim.fn.executable('pandoc') == 1 then + vim.cmd("execute '!pandoc -o ' . substitute(expand('%:p'), '.tex', '.html ', '') . expand('%:p')") + else + print("pandoc is not installed") + end + end, +}) |
