SoloVim/lua/plugins/obsidian.lua

57 lines
1.6 KiB
Lua

return {
"epwalsh/obsidian.nvim",
version = "*",
lazy = true,
event = "BufReadPre " .. vim.fn.expand("~") .. "/Obsidian/**/*.md",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
"nvim-treesitter/nvim-treesitter",
},
opts = {
workspaces = {
{
name = "university",
path = "~/Obsidian/university",
},
{
name = "personal",
path = "~/Obsidian/personal",
},
{
name = "work",
path = "~/Obsidian/work",
},
},
templates = {
folder = "templates",
date_format = "%Y-%m-%d",
time_format = "%H:%M:%S",
},
attachments = {
-- The default folder to place images in via `:ObsidianPasteImg`.
-- If this is a relative path it will be interpreted as relative to the vault root.
-- You can always override this per image by passing a full path to the command instead of just a filename.
img_folder = "assets/img",
-- Optional, customize the default name or prefix when pasting images via `:ObsidianPasteImg`.
---@return string
img_name_func = function()
print(os.time())
return string.format("%s-", os.time())
end,
-- A function that determines the text to insert in the note when pasting an image.
-- It takes two arguments, the `obsidian.Client` and an `obsidian.Path` to the image file.
-- This is the default implementation.
---@param client obsidian.Client
---@param path obsidian.Path the absolute path to the image file
---@return string
img_text_func = function(client, path)
path = client:vault_relative_path(path) or path
return string.format("![%s](../%s)", path.name, path)
end,
},
},
}