Skip to content

Add sidekick.nvim #1655

@Yorizel

Description

@Yorizel

Is your feature related to a problem?

Folke released an awesome new p[lugin for handling ai with built in nes support using the copilot api

Describe the new feature

Add the new sidekick plugin on the editor support category

Additional context

this is my current config, if anyone is interested

return {
  "folke/sidekick.nvim",
  event = "VeryLazy",
  opts = {
    cli = {
      mux = {
        backend = "tmux",
        enabled = true,
      },
    },
    -- Remove the keys.accept = nil since we're handling Tab directly
  },
  specs = {
    {
      "AstroNvim/astrocore",
      ---@param opts AstroCoreOpts
      opts = function(_, opts)
        local maps = assert(opts.mappings)
        local prefix = "<Leader>a"

        -- Normal mode mappings
        maps.n[prefix] = { desc = "+ Sidekick" }
        maps.n[prefix .. "a"] = {
          function() require("sidekick.cli").toggle { focus = true } end,
          desc = "Sidekick Toggle CLI",
        }
        maps.n[prefix .. "c"] = {
          function() require("sidekick.cli").toggle { name = "claude", focus = true } end,
          desc = "Sidekick Claude Toggle",
        }
        maps.n[prefix .. "p"] = {
          function() require("sidekick.cli").prompt() end,
          desc = "Sidekick Ask Prompt",
        }

        -- Visual mode mappings
        maps.v[prefix] = { desc = "+ai" }
        maps.v[prefix .. "a"] = {
          function() require("sidekick.cli").toggle { focus = true } end,
          desc = "Sidekick Toggle CLI",
        }
        maps.v[prefix .. "p"] = {
          function() require("sidekick.cli").prompt() end,
          desc = "Sidekick Ask Prompt",
        }

        maps.n["<tab>"] = {
          function()
            -- if there is a next edit, jump to it, otherwise apply it if any
            if not require("sidekick").nes_jump_or_apply() then
              return "<Tab>" -- fallback to normal tab
            end
          end,
          expr = true,
          desc = "Goto/Apply Next Edit Suggestion",
        }
      end,
    },
  },
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions