feat: fennelize obsidian-sync
This commit is contained in:
parent
e58f6efffe
commit
06e3caa65e
2 changed files with 21 additions and 9 deletions
14
fnl/scripts/obsidian-sync.fnl
Normal file
14
fnl/scripts/obsidian-sync.fnl
Normal file
|
@ -0,0 +1,14 @@
|
|||
(vim.api.nvim_create_user_command :VaultSync
|
||||
(fn []
|
||||
(let [date (os.date "%Y-%m-%d %H:%M:%S")
|
||||
commit-commands ["git add -A"
|
||||
(string.format "git commit -m \"auto-update(nvim): %s\""
|
||||
date)]]
|
||||
(each [_ cmd (ipairs commit-commands)]
|
||||
(vim.fn.system cmd))
|
||||
(vim.notify "Committed all local changes."
|
||||
vim.log.levels.INFO)
|
||||
(vim.cmd "Neogit push")))
|
||||
{})
|
||||
|
||||
(vim.keymap.set :n :<leader>os vim.cmd.VaultSync)
|
16
lua/scripts/obsidian-sync.lua
generated
16
lua/scripts/obsidian-sync.lua
generated
|
@ -1,14 +1,12 @@
|
|||
vim.api.nvim_create_user_command("VaultSync", function()
|
||||
-- [nfnl] Compiled from ./fnl/scripts/obsidian-sync.fnl by https://github.com/Olical/nfnl, do not edit.
|
||||
local function _1_()
|
||||
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),
|
||||
}
|
||||
local commit_commands = {"git add -A", string.format("git commit -m \"auto-update(nvim): %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>os", vim.cmd.VaultSync)
|
||||
return vim.cmd("Neogit push")
|
||||
end
|
||||
vim.api.nvim_create_user_command("VaultSync", _1_, {})
|
||||
return vim.keymap.set("n", "<leader>os", vim.cmd.VaultSync)
|
||||
|
|
Loading…
Reference in a new issue