local prefix = "o" return { { import = "plugins.extras.lang.markdown-extended" }, { -- "epwalsh/obsidian.nvim", "obsidian-nvim/obsidian.nvim", -- NOTE: Using a fork from the community -- ft = "markdown", event = "BufReadPre " .. vim.fn.expand("~") .. "/documents/obsidian/**.md", keys = { { prefix .. "o", "Obsidian open", desc = "Open on App" }, { prefix .. "g", "Obsidian search", desc = "Grep" }, { prefix .. "n", "Obsidian new", desc = "New Note" }, { prefix .. "N", "Obsidian new_from_template", desc = "New Note (Template)" }, { prefix .. "", "Obsidian quick_switch", desc = "Find Files" }, { prefix .. "b", "Obsidian backlinks", desc = "Backlinks" }, { prefix .. "t", "Obsidian tags", desc = "Tags" }, { prefix .. "T", "Obsidian template", desc = "Template" }, { prefix .. "L", "Obsidian link", mode = "v", desc = "Link" }, { prefix .. "l", "Obsidian links", desc = "Links" }, { prefix .. "l", "Obsidian link_new", mode = "v", desc = "New Link" }, { prefix .. "e", "Obsidian extract_note", mode = "v", desc = "Extract Note" }, { prefix .. "w", "Obsidian workspace", desc = "Workspace" }, { prefix .. "r", "Obsidian rename", desc = "Rename" }, { prefix .. "i", "Obsidian paste_img", desc = "Paste Image" }, { prefix .. "d", "Obsidian dailies", desc = "Daily Notes" }, }, opts = { workspaces = { { name = "personal-brain", path = "~/documents/obsidian/personal-brain/vault", }, }, notes_subdir = "01 - Bandeja Entrada", daily_notes = { folder = "03 - Diario/Diariamente", date_format = "%Y-%m-%d", alias_format = "%B %-d, %Y", template = "00 - Data/Plantillas/Diariamente.md", }, completion = { nvim_cmp = false, blink = true, }, create_new = false, picker = { name = "snacks.pick", note_mappings = { -- Create a new note from your query. new = "", -- Insert a link to the selected note. insert_link = "", }, tag_mappings = { -- Add tag(s) to current note. tag_note = "", -- Insert a tag at the current location. insert_tag = "", }, }, mappings = { ["gf"] = { action = function() return require("obsidian").util.gf_passthrough() end, opts = { noremap = false, expr = true, buffer = true }, }, [""] = { action = function() return require("obsidian").util.toggle_checkbox() end, opts = { buffer = true }, }, [""] = { action = function() return require("obsidian").util.smart_action() end, opts = { buffer = true, expr = true }, }, }, new_notes_location = "notes_subdir", templates = { subdir = "00 - Data/Plantillas", date_format = "%Y-%m-%d", time_format = "%H:%M", }, ---@param spec { id: string, dir: obsidian.Path, title: string|? } ---@return string|obsidian.Path The full path to the new note. note_path_func = function(spec) return spec.title end, note_frontmatter_func = function(note) if note.title then note:add_alias(note.title) end local out = { aliases = note.aliases } 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, follow_url_func = function(url) vim.fn.jobstart({ "xdg-open", url }) end, attachments = { img_folder = "00 - Data/Documentos", }, ui = { enable = false }, statusline = { enabled = true, format = "{{backlinks}} backlinks | {{words}} words", }, }, }, { "folke/snacks.nvim", keys = { { prefix .. "k", function() Snacks.picker.grep({ search = "^\\s*- \\[ \\]", regex = true, dirs = { vim.fn.getcwd() }, finder = "grep", format = "file", show_empty = true, supports_live = false, live = false, }) end, desc = "Tasks (Unfinished)", }, { prefix .. "K", function() Snacks.picker.grep({ search = "^\\s*- \\[x\\]:", regex = true, dirs = { vim.fn.getcwd() }, finder = "grep", format = "file", show_empty = true, supports_live = false, live = false, }) end, desc = "Tasks (Finished)", }, }, }, { "folke/which-key.nvim", opts = { spec = { { prefix, group = "obsidian", icon = " ", mode = { "n", "v" } }, }, }, }, { "nvim-lualine/lualine.nvim", optional = true, opts = function(_, opts) table.insert(opts.sections.lualine_x, 1, "g:obsidian") end, }, }