require("obsidian").setup({ legacy_commands = false, picker = { name = "snacks.pick", }, ui = { enable = true, }, workspaces = { { name = "NCA notes", path = vim.fn.expand "~" .. "/Documents/nca-notes/", }, }, notes_subdir = "Inbox", daily_notes = { folder = "Dailies", date_format = "%Y-%m-%d-%a", alias_fomat = "%B %-d, %Y", default_tags = { "daily-notes" }, }, new_notes_location = "notes_subdir", templates = { subdir = "Templates", date_format = "%Y-%m-%d-%a", time_format = "%H:%M", tags = "", }, completion = { -- nvim_cmp = false, -- blink = true, min_chars = 2, }, link = { style = "wiki", }, note_id_func = function(title) local suffix = "" if title ~= nil then suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower() else for _ = 1, 4 do suffix = suffix .. string.char(math.random(65, 90)) suffix = tostring(os.time()) .. "-" .. suffix end end return suffix end, callbacks = { enter_note = function(note) vim.keymap.set('n', 'k.', 'Obsidian toggle_checkbox', { desc = 'toggle checkbox', buffer = note.bufnr, silent = true }) vim.keymap.set('n', 'kp', 'Obsidian paste_img', { desc = 'paste img', buffer = note.bufnr, silent = true }) vim.keymap.set('n', 'kt', 'Obsidian tags', { desc = 'tags', buffer = note.bufnr, silent = true }) vim.keymap.set('n', 'k`', 'Obsidian backlinks', { desc = 'backlinks', buffer = note.bufnr, silent = true }) vim.keymap.set('n', 'kx', 'Obsidian follow_link', { desc = 'follow link', buffer = note.bufnr, silent = true }) vim.keymap.set('n', 'ksl', 'Obsidian links', { desc = 'links', buffer = note.bufnr, silent = true }) vim.keymap.set('n', 'kr', 'Obsidian rename', { desc = 'rename', buffer = note.bufnr, silent = true }) vim.keymap.set('n', 'ksc', 'Obsidian toc', { desc = 'toc', buffer = note.bufnr, silent = true }) vim.keymap.set('v', 'kx', 'Obsidian link', { desc = 'links', buffer = note.bufnr, silent = true }) vim.keymap.set('v', 'kl', 'Obsidian link_new', { desc = 'links', buffer = note.bufnr, silent = true }) end, }, }) vim.keymap.set("v", "kx", "Obsidian extract_note", { desc = "Extract Note" }) vim.keymap.set("n", "knn", "Obsidian new", { desc = "New Obsidian note" }) vim.keymap.set("n", "knt", "Obsidian new_from_template", { desc = "New from template" }) vim.keymap.set("n", "ksq", "Obsidian quick_switch", { desc = "Quick Switch" }) vim.keymap.set("n", "kss", "Obsidian search", { desc = "Search Obsidian notes" }) vim.keymap.set("n", "kdt", "Obsidian today", { desc = "Daily Today" }) vim.keymap.set("n", "kdy", "Obsidian yesterday", { desc = "Daily Yesterday" }) vim.keymap.set("n", "kdw", "Obsidian tomorrow", { desc = "Daily Tomorrow" }) vim.keymap.set("n", "kdd", "Obsidian dailies", { desc = "Dailies" }) vim.keymap.set("n", "kw", "Obsidian workspace", { desc = "Change Workspace" })