Adds pull when entering notes

This commit is contained in:
Michel 2025-01-01 16:30:48 +01:00
parent c0cb36520e
commit fad0c5c6c1
7 changed files with 63 additions and 41 deletions

View file

@ -31,7 +31,7 @@ vim.api.nvim_create_autocmd("BufWritePost", {
})
vim.api.nvim_create_autocmd("VimLeavePre", {
callback = function(args)
callback = function()
print("Pushing changes...")
-- Push twice, in case the credentials expired. Ugly hack, but it works
local pushSuccess = os.execute("git push &> /dev/null")
@ -42,3 +42,14 @@ vim.api.nvim_create_autocmd("VimLeavePre", {
print("Done")
end,
})
vim.api.nvim_create_autocmd("VimEnter", {
callback = function()
print("Updating...")
local command = "git pull --rebase --quiet --no-edit &> /dev/null"
local pullSuccess = os.execute(command)
if pullSuccess > 0 then
os.execute(command)
end
end,
})