viminal2/lua/scripts/obsidian-sync.lua

15 lines
445 B
Lua
Raw Permalink Normal View History

2024-12-28 23:55:45 -08:00
vim.api.nvim_create_user_command("VaultSync", function()
local date = os.date("%Y-%m-%d %H:%M:%S")
local commit_commands = {
"git add -A",
string.format([[git commit -m "auto-update(nvim): %s"]], date),
2024-12-28 23:55:45 -08:00
}
for _, cmd in ipairs(commit_commands) do
vim.fn.system(cmd)
end
vim.notify("Committed all local changes.", vim.log.levels.INFO)
vim.cmd("Neogit push")
end, {})
2024-12-29 15:53:42 -08:00
vim.keymap.set("n", "<leader>os", vim.cmd.VaultSync)