Configure nvim obsidian

This commit is contained in:
Martin
2025-07-09 21:21:25 +02:00
parent 1e9873bae4
commit 2517fd0269

View File

@ -312,6 +312,11 @@ require("obsidian").setup({
path = "~/Documents/notes/fromjoplin", path = "~/Documents/notes/fromjoplin",
}, },
}, },
templates = {
folder = "_templates",
date_format = "%Y-%m-%d-%a",
time_format = "%H:%M",
},
ui = { ui = {
checkboxes = { checkboxes = {
[" "] = { char = "󰄱", hl_group = "ObsidianTodo" }, [" "] = { char = "󰄱", hl_group = "ObsidianTodo" },
@ -321,5 +326,38 @@ require("obsidian").setup({
["!"] = { char = "", hl_group = "ObsidianImportant" }, ["!"] = { char = "", hl_group = "ObsidianImportant" },
}, },
}, },
disable_frontmatter = true, disable_frontmatter = false,
note_frontmatter_func = function(note)
-- Add the title of the note as an alias.
if note.title then
note:add_alias(note.title)
end
local out = { id = note.id, tags = note.tags }
-- `note.metadata` contains any manually added fields in the frontmatter.
-- So here we just make sure those fields are kept in the frontmatter.
if note.metadata ~= nil and not vim.tbl_isempty(note.metadata) then
for k, v in pairs(note.metadata) do
out[k] = v
end
end
return out
end,
note_path_func = function(spec)
-- This is equivalent to the default behavior.
local path = spec.dir / spec.title
return path:with_suffix(".md")
end,
daily_notes = {
-- Optional, if you keep daily notes in a separate directory.
folder = "Journal",
-- Optional, if you want to change the date format for the ID of daily notes.
date_format = "%Y-%m-%d",
-- Optional, default tags to add to each new daily note created.
default_tags = { "journal" },
-- Optional, if you want to automatically insert a template from your template directory like 'daily.md'
template = "daily.md"
},
}) })