diff --git a/lua/lazyvim/plugins/extras/ai/sidekick.lua b/lua/lazyvim/plugins/extras/ai/sidekick.lua new file mode 100644 index 00000000..54974b6e --- /dev/null +++ b/lua/lazyvim/plugins/extras/ai/sidekick.lua @@ -0,0 +1,49 @@ +return { + desc = "Next edit suggestions with the Copilot LSP server", + + -- copilot-language-server + { + "neovim/nvim-lspconfig", + opts = { + servers = { + copilot = {}, + }, + }, + }, + + -- lualine + { + "nvim-lualine/lualine.nvim", + optional = true, + event = "VeryLazy", + opts = function(_, opts) + table.insert( + opts.sections.lualine_x, + 2, + LazyVim.lualine.status(LazyVim.config.icons.kinds.Copilot, function() + local status = require("sidekick.status").get() + if status then + return status.kind == "Error" and "error" or status.busy and "pending" or "ok" + end + end) + ) + end, + }, + + { + "folke/sidekick.nvim", + opts = function() + -- Accept inline suggestions or next edits + LazyVim.cmp.actions.ai_nes = function() + local Nes = require("sidekick.nes") + if Nes.have() and (Nes.jump() or Nes.apply()) then + return true + end + end + end, + keys = { + -- nes is also useful in normal mode + { "", LazyVim.cmp.map({ "ai_nes" }, ""), mode = { "n" }, expr = true }, + }, + }, +}