-- Mapping data with "desc" stored directly by vim.keymap.set().
--
-- Please use this mappings table to set keyboard mapping since this is the
-- lower level configuration and more robust one. (which-key will
-- automatically pick-up stored data by this setting.)

return {
  -- first key is the mode
  n = {
    ["<leader>bD"] = {
      function()
        require("astronvim.utils.status").heirline.buffer_picker(function(bufnr) require("astronvim.utils.buffer").close(
          bufnr) end)
      end,
      desc = "Pick to close",
    },

    ["<leader>b"] = { name = "Buffers" },
    ["<tab>"] = { ":bnext<cr>", desc = "Next buffer tab" },

    -- Open file
    ["<leader><space>"] = { ":Telescope find_files search_dirs=~/<cr>", desc = "Open file" },
    ["<leader><C-space>"] = { ":Telescope find_files search_dirs=~/ hidden=true<cr>", desc =
    "Open file inc. hidden files" },

    -- Make
    ["<leader>m"] = { name = "Make (Compile)" },
    ["<leader>mm"] = { ":make<cr>", desc = "Make" },
    ["<leader>mn"] = { ":make clean<cr>", desc = "Make clean" },
    ["<leader>mr"] = { ":make run<cr>", desc = "Make run" },
    ["<leader>mu"] = { ":make upload<cr>", desc = "Make upload" },

    -- Go to source file
    ["gs"] = { ":ClangdSwitchSourceHeader<cr>" },

    -- Format code
    ["<M-f>"] = { ":Format<cr>" },
    ["<leader>a"] = { ":lua require'rust-tools'.hover_actions.hover_actions()<cr>" },
    -- Disable bindings
    ["<leader>n"] = false,
  },
  t = {
    -- setting a mapping to false will disable it
    -- ["<esc>"] = false,
  },
}
