feat: add vault quick syncer script

This commit is contained in:
Youwen Wu 2024-12-28 23:55:45 -08:00
parent 893839a52e
commit fa20c77607
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
2 changed files with 15 additions and 0 deletions

View file

@ -1,5 +1,6 @@
require("keymaps")
require("plugins")
require("scripts.obsidian-sync")
require("scripts.autoroot").setup()

View file

@ -0,0 +1,14 @@
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 "neovim-update: %s"]], date),
}
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, {})
vim.keymap.set("n", "<leader>vs", vim.cmd.VaultSync)