local function handle_enter() local util = require("obsidian.util") if util.cursor_on_markdown_link(nil, nil, true) then vim.cmd("ObsidianFollowLink") else local line = vim.api.nvim_get_current_line() if string.match(line, "^%s*- %[[x ]%].*") then util.toggle_checkbox() else vim.cmd("normal! viw:'<,'>ObsidianLink") end end end return { "epwalsh/obsidian.nvim", version = "*", -- recommended, use latest release instead of latest commit lazy = false, dependencies = { "nvim-lua/plenary.nvim" }, opts = { workspaces = { { name = "Lumentis", path = "~/Workspace/Notes/Lumentis", }, { name = "Lumentis-Players", path = "~/Workspace/Notes/Lumentis-Players", }, { name = "Personal", path = "~/Workspace/Notes/Personal", overrides = { daily_notes = { folder = "Daily", }, }, }, { name = "PhD", path = "~/Workspace/Notes/PhD", overrides = { daily_notes = { folder = "Daily", }, }, }, { name = "DnD", path = "~/Workspace/Notes/DnD", override = { daily_notes = { folder = ".", }, }, }, }, note_id_func = function(title) return title end, disable_frontmatter = true, ui = { hl_groups = { ObsidianRefText = { fg = "#61afef" }, } } }, keys = { {"", handle_enter, ft = "markdown" }, {"", "ObsidianLink", ft = "markdown", mode = "v"}, {"rn", "ObsidianRename", ft = "markdown" }, {"l", "i- [ ] ", ft = "markdown"}, {"o", "o- [ ] ", ft = "markdown"}, {"l", "- [ ] ", ft = "markdown", mode = "i" }, {"jt", "ObsidianToday"}, {"jy", "ObsidianYesterday"}, {"ju", "ObsidianTomorrow"}, {"", ":set nohlsearch/\\[[^\\[\\]]*\\]([^()]*):let @/ = \"\":set hlsearch", ft = "markdown", silent = true }, }, config = function (_, opts) require("obsidian").setup(opts) end }