local git = require("functions.git") -- Autocmds are automatically loaded on the VeryLazy event -- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua -- Add any additional autocmds here local enabledGit = os.getenv("ENABLE_GIT_SETUP") or false vim.api.nvim_create_autocmd("BufWritePost", { pattern = { "*.md" }, callback = function(args) if not enabledGit then return end git.commitFile(args.file) end, }) vim.api.nvim_create_autocmd("VimLeavePre", { callback = function() if not enabledGit then return end git.commitRest() git.push() end, }) vim.api.nvim_create_autocmd("VimEnter", { callback = function() if not enabledGit then return end git.pull() end, })