Recipe: WeeklyRecap
#362
Replies: 4 comments
-
vim.api.nvim_create_user_command("WeeklyRecap", function()
local Note = require("obsidian.note")
Note.create({
title = string.format("Week %d, %d", os.date("%V"), os.date("%Y")),
id = string.format("%d-W%02d", os.date("%Y"), os.date("%V")),
dir = Obsidian.dir / "journal/weekly-review",
tags = { "journal", "weekly-recap" },
}):open()
end, { desc = "Create weekly recap note" }) Hi, this is my try at your command, it partially works, because the api was refactored to fit the need of other stuff at the time and is not completely thought out, now it only places the correct dir, and use title as filename and id, id and tags seems to be not working, which I will fix soon. Also, Better yet, you can follow: https://github.com/obsidian-nvim/obsidian.nvim/wiki/Extensions just move the logic as a function in and then you can use |
Beta Was this translation helpful? Give feedback.
-
@ellisra my version should work as intended now, try it |
Beta Was this translation helpful? Give feedback.
-
Nice, this seems to be working now, thanks! |
Beta Was this translation helpful? Give feedback.
-
One thing to note with this new approach; vim.api.nvim_create_user_command("WeeklyRecap", function()
local Note = require("obsidian.note")
Note.create({
title = string.format("Week %d, %d", os.date("%V"), os.date("%Y")),
id = string.format("%d-W%02d", os.date("%Y"), os.date("%V")),
dir = Obsidian.dir / "journal/weekly-review",
tags = { "journal", "weekly-recap" },
should_write = true,
}):open()
end, { desc = "Create weekly recap note" }) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a collection of user commands in my config for creating specific notes in defined directories, such as this example:
After updating the plugin I see that many
Client
features are being deprecated in favour ofNote
but I've been unable to migrate these commands correctly. Additionally the newObsidian.dir
which is meant to replaceClient.dir
seems to be returningnil
when called in a command. I apologise if any of my explanation is unclear as I'm not super familiar with the inner workings of this plugin, I'm happy to provide additional context if it would be helpful.Beta Was this translation helpful? Give feedback.
All reactions