summaryrefslogtreecommitdiff
path: root/lua/utility/autocmd.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/utility/autocmd.lua')
-rw-r--r--lua/utility/autocmd.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/lua/utility/autocmd.lua b/lua/utility/autocmd.lua
new file mode 100644
index 0000000..948497d
--- /dev/null
+++ b/lua/utility/autocmd.lua
@@ -0,0 +1,15 @@
+function autocmd(event, pattern, command)
+ vim.cmd("autocmd " .. event .. " " .. pattern .. " " .. command)
+end
+
+function augroup(name, autocommands)
+ vim.cmd("augroup " .. name)
+ vim.cmd("autocmd!")
+
+ for _, autocmd_args in ipairs(autocommands) do
+ autocmd(unpack(autocmd_args))
+ end
+
+ vim.cmd("augroup end")
+end
+