[nvim] Updates obsidian options: better file names
This commit is contained in:
@@ -24,6 +24,14 @@ return {
|
||||
path = "~/Documents/Notes",
|
||||
},
|
||||
},
|
||||
|
||||
-- Can I enable this somehow? I'm using blink.cmp but this is triggering
|
||||
-- it to look for nvim-cmp directly.
|
||||
-- completion = {
|
||||
-- nvim_cmp = true,
|
||||
-- min_chars = 2,
|
||||
-- },
|
||||
|
||||
daily_notes = {
|
||||
-- Optional, if you keep daily notes in a separate directory.
|
||||
folder = "Daily Notes",
|
||||
@@ -32,11 +40,13 @@ return {
|
||||
-- Optional, if you want to automatically insert a template from your template directory like ''
|
||||
template = "Daily Note",
|
||||
},
|
||||
|
||||
templates = {
|
||||
folder = "Templates",
|
||||
date_format = "%Y-%m-%d",
|
||||
time_format = "%H:%M",
|
||||
},
|
||||
|
||||
ui = {
|
||||
-- Disable the UI features and let render-markdown.nvim handle it.
|
||||
enable = false,
|
||||
@@ -48,5 +58,25 @@ return {
|
||||
[">"] = { char = "⛝", hl_group = "ObsidianDone" },
|
||||
},
|
||||
},
|
||||
|
||||
-- Put the note ID in the wiki links
|
||||
wiki_link_func = "prepend_note_id",
|
||||
preferred_link_style = "wiki",
|
||||
|
||||
-- Customize how note IDs are generated given an optional title.
|
||||
---@param title string|?
|
||||
---@return string
|
||||
note_id_func = function(title)
|
||||
if title ~= nil then
|
||||
-- If title is given, transform it into valid file name by removing most special characters
|
||||
-- Note that parens are not supported because they interfere with markdown links.
|
||||
return title:gsub("[^A-Za-z0-9-_]", ""):lower()
|
||||
else
|
||||
-- If title is nil, just put the date and four random characters
|
||||
for _ = 1, 4 do
|
||||
return os.date("%Y-%m-%d ") .. string.char(math.random(65, 90))
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user