feat: add vault quick syncer script
This commit is contained in:
parent
893839a52e
commit
fa20c77607
2 changed files with 15 additions and 0 deletions
1
init.lua
1
init.lua
|
@ -1,5 +1,6 @@
|
|||
require("keymaps")
|
||||
require("plugins")
|
||||
require("scripts.obsidian-sync")
|
||||
|
||||
require("scripts.autoroot").setup()
|
||||
|
||||
|
|
14
lua/scripts/obsidian-sync.lua
Normal file
14
lua/scripts/obsidian-sync.lua
Normal 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)
|
Loading…
Reference in a new issue