You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have added 2 of my own commands that switch to the previous/next daily note based on the currently open note in buffer.
The only issue is that there is no support for custom date formats, so the commands only work on filename dates with the default %Y-%m-%d format.
localoffset_daily=function(offset)
localfilename=vim.fn.expand("%:t:r")
localyear, month, day=filename:match("(%d+)-(%d+)-(%d+)")
localdate=os.time({ year=year, month=month, day=day })
localclient=require("obsidian").get_client()
localnote=client:_daily(date+ (offset*3600*24))
client:open_note(note)
endvim.api.nvim_create_user_command("ObsidianPrevDay", function(_)
offset_daily(-1)
end, {
bang=false,
bar=false,
register=false,
desc="Create and switch to the previous daily note based on current buffer",
})
vim.api.nvim_create_user_command("ObsidianNextDay", function(_)
offset_daily(1)
end, {
bang=false,
bar=false,
register=false,
desc="Create and switch to the next daily note based on current buffer",
})
A PR could be started if custom date parsing is implemented.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have added 2 of my own commands that switch to the previous/next daily note based on the currently open note in buffer.
The only issue is that there is no support for custom date formats, so the commands only work on filename dates with the default
%Y-%m-%d
format.A PR could be started if custom date parsing is implemented.
Beta Was this translation helpful? Give feedback.
All reactions