-- obsidian.lua: Integrates Obsidian note-taking workflow into Neovim.

return {
  {
    "epwalsh/obsidian.nvim",
    version = "*",
    lazy = true,
    ft = "markdown",
    dependencies = {
      "nvim-lua/plenary.nvim",
    },
    opts = {
      workspaces = {
        {
          name = "liph",
          path = "/mnt/flash1/podman/lxc_servarr/nextcloud/config/obsidian/vaults",
        },
      },

      completion = {
        nvim_cmp = true,
        min_chars = 2,
      },

      mappings = {
        ["<leader>ch"] = {
          action = function()
            return require("obsidian").util.toggle_checkbox()
          end,
          opts = { buffer = true, desc = "Toggle checkbox" },
        },
        ["<cr>"] = {
          action = function()
            return require("obsidian").util.smart_action()
          end,
          opts = { buffer = true, expr = true },
        },
        ["gf"] = {
          action = function()
            return require("obsidian").util.gf_passthrough()
          end,
          opts = { noremap = false, expr = true, buffer = true },
        },
      },

      note_id_func = function(title)
        return title
      end,

      ui = {
        enable = false, -- DISABLE Obsidian UI, use markview instead
      },
    },
  },
}
