-- Better project/cd support

return {
  {
    "gnikdroy/projections.nvim",
    config = function()
      require("projections").setup({
        workspaces = {
          "~/Projects/Personal",
        },
      })
      require("telescope").load_extension("projections")

      -- Load project if started in a project directory
      local switcher = require("projections.switcher")
      vim.api.nvim_create_autocmd({ "VimEnter" }, {
        callback = function()
          if vim.fn.argc() == 0 then
            switcher.switch(vim.loop.cwd())
          end
        end,
      })
    end,
    keys = {
      { "<leader>fp", "<cmd>Telescope projections<CR>", desc = "Search projects" },
    },
  },
  {
    "nvimdev/dashboard-nvim",
    opts = function(_, opts)
      local button = {
        action = "Telescope projections",
        desc = "Projects",
        icon = "🕮  ",
        key = "p",
      }

      button.key_format = "  %s"
      table.insert(opts.config.center, 6, button)
    end,
  },
}