summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/user/autocommds.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/user/autocommds.lua')
-rw-r--r--.config/nvim/lua/user/autocommds.lua43
1 files changed, 43 insertions, 0 deletions
diff --git a/.config/nvim/lua/user/autocommds.lua b/.config/nvim/lua/user/autocommds.lua
new file mode 100644
index 0000000..934cda8
--- /dev/null
+++ b/.config/nvim/lua/user/autocommds.lua
@@ -0,0 +1,43 @@
+
+local reloadgroup = vim.api.nvim_create_augroup("ReloadGroup", { clear = true })
+require'user.remaps'
+
+vim.api.nvim_create_autocmd (
+ "BufWritePost",
+ {
+ group = reloadgroup,
+ pattern = "*.tex",
+ callback = function()
+ vim.system( {'bash',
+ '-c',
+ "latexmk -shell-escape -xelatex " .. vim.fn.expand('%:t') .. " && pkill -HUP mupdf"},
+ {detach = true})
+ end}
+)
+
+vim.api.nvim_create_autocmd (
+ {"BufRead", "BufNewFile"}, {
+ pattern = {"*.tex"},
+ callback = function()
+ if (global_inde == nil) then
+ global_inde = vim.opt.indentexpr:get()
+ end
+ vim.bo.autoindent = false
+ vim.bo.smartindent = false
+ vim.bo.cindent = false
+ vim.bo.indentexpr = nil
+ end,
+})
+
+-- vim.api.nvim_create_autocmd (
+-- "InsertEnter", {
+-- once = true,
+-- group = reloadgroup,
+-- pattern = "*.tex",
+-- callback = function()
+-- vim.system(
+-- {'latexmk', '-xelatex', '-pvc', vim.fn.expand('%:t')},
+-- { detach = true })
+-- end
+-- }
+-- )