local telekasten = require("telekasten")
telekasten.setup({
  home = vim.fn.expand("~/Nextcloud/Notes/zettelkasten"),
  auto_set_filetype = false,
  image_subdir = "assets",
})

vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
  pattern = "*/zettelkasten/*",
  callback = function(_)
    require("which-key").register({
      g = {
        f = { telekasten.follow_link, "Follow link" },
        r = { telekasten.show_backlinks, "Show backlinks" },
      },
      ["<leader>"] = {
        f = {
          f = { telekasten.find_notes, "Find note" },
          n = { telekasten.new_note, "New note" },
        },
        s = {
          g = { telekasten.search_note, "Grep notes" },
        },
      },
    }, { buffer = vim.fn.bufnr("%") })
  end,
})
