[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-73390":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":36,"readmeContent":37,"aiSummary":38,"trendingCount":16,"starSnapshotCount":16,"syncStatus":39,"lastSyncTime":40,"discoverSource":41},73390,"sidekick.nvim","folke\u002Fsidekick.nvim","folke","Your Neovim AI sidekick","",null,"Lua",2646,135,16,8,0,9,18,55,27,28.4,"Apache License 2.0",false,"main",true,[27,28,29,30,31,32,33,34,35],"claude-code","codex-cli","copilot","copilot-cli","gemini-cli","neovim","neovim-plugin","nvim","nvim-plugin","2026-06-12 02:03:12","# 🤖 `sidekick.nvim`\n\n**sidekick.nvim** is your Neovim AI sidekick that integrates Copilot LSP's\n\"Next Edit Suggestions\" with a built-in terminal for any AI CLI.\nReview and apply diffs, chat with AI assistants, and streamline your coding,\nwithout leaving your editor.\n\n\u003Cimg width=\"2311\" height=\"1396\" alt=\"image\" src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F63a33610-9a8e-45e2-bbd0-b7e3a4fde621\" \u002F>\n\n## ✨ Features\n\n- **🤖 Next Edit Suggestions (NES) powered by Copilot LSP**\n  - 🪄 **Automatic Suggestions**: Fetches suggestions automatically when you pause typing or move the cursor.\n  - 🎨 **Rich Diffs**: Visualizes changes with inline and block-level diffs, featuring Treesitter-based syntax highlighting with granular diffing down to the word or character level.\n  - 🧭 **Hunk-by-Hunk Navigation**: Jump through edits to review them one by one before applying.\n  - 📊 **Statusline Integration**: Shows Copilot LSP's status, request progress, and preview text in your statusline.\n\n- **💬 Integrated AI CLI Terminal**\n  - 🚀 **Direct Access to AI CLIs**: Interact with your favorite AI command-line tools without leaving Neovim.\n  - 📦 **Pre-configured for Popular Tools**: Out-of-the-box support for Claude, Gemini, Grok, Codex, Copilot CLI, and more.\n  - ✨ **Context-Aware Prompts**: Automatically include file content, cursor position, and diagnostics in your prompts.\n  - 📝 **Prompt Library**: A library of pre-defined prompts for common tasks like explaining code, fixing issues, or writing tests.\n  - 🔄 **Session Persistence**: Keep your CLI sessions alive with `tmux` and `zellij` integration.\n  - 📂 **Automatic File Watching**: Automatically reloads files in Neovim when they are modified by AI tools.\n\n- **🔌 Extensible and Customizable**\n  - ⚙️ **Flexible Configuration**: Fine-tune every aspect of the plugin to your liking.\n  - 🧩 **Plugin-Friendly API**: A rich API for integrating with other plugins and building custom workflows.\n  - 🎨 **Customizable UI**: Change the appearance of diffs, signs, and more.\n\n## 📋 Requirements\n\n- **Neovim** `>= 0.11.2` or newer\n- The official [copilot-language-server](https:\u002F\u002Fgithub.com\u002Fgithub\u002Fcopilot-language-server-release) LSP server,\n  enabled with `vim.lsp.enable`. Can be installed in multiple ways:\n  1. install using `npm` or your OS's package manager\n  2. install with [mason-lspconfig.nvim](https:\u002F\u002Fgithub.com\u002Fmason-org\u002Fmason-lspconfig.nvim)\n  3. [copilot.lua](https:\u002F\u002Fgithub.com\u002Fzbirenbaum\u002Fcopilot.lua) and [copilot.vim](https:\u002F\u002Fgithub.com\u002Fgithub\u002Fcopilot.vim)\n     both bundle the LSP Server in their plugin.\n- A working `lsp\u002Fcopilot.lua` configuration.\n  - **TIP:** Included in [nvim-lspconfig](https:\u002F\u002Fgithub.com\u002Fneovim\u002Fnvim-lspconfig)\n- [snacks.nvim](https:\u002F\u002Fgithub.com\u002Ffolke\u002Fsnacks.nvim) for better prompt\u002Ftool selection **_(optional)_**\n- [nvim-treesitter-textobjects](https:\u002F\u002Fgithub.com\u002Fnvim-treesitter\u002Fnvim-treesitter-textobjects) **_(`main` branch)_** for `{function}` and `{class}` context variables **_(optional)_**\n- AI cli tools, such as Codex, Claude, Copilot, Gemini, … **_(optional)_**\n  see the [🤖 AI CLI Integration](#-ai-cli-integration) section for details.\n- [lsof](https:\u002F\u002Fman7.org\u002Flinux\u002Fman-pages\u002Fman8\u002Flsof.8.html) and [ps](https:\u002F\u002Fman7.org\u002Flinux\u002Fman-pages\u002Fman1\u002Fps.1.html) are used\n  on Unix-like systems to detect running AI CLI tool sessions. **_(optional, but recommended)_**\n\n## 🚀 Quick Start\n\n1. **Install** the plugin with your package manager (see below)\n2. **Configure Copilot LSP** - must be enabled with `vim.lsp.enable`\n3. **Check health**: `:checkhealth sidekick`\n4. **Sign in to Copilot**: `:LspCopilotSignIn`\n5. **Try it out**:\n   - Type some code and pause - watch for Next Edit Suggestions appearing\n   - Press `\u003CTab>` to navigate through or apply suggestions\n   - Use `\u003Cleader>aa` to open AI CLI tools\n\n> [!NOTE]\n> **New to Next Edit Suggestions?** Unlike inline completions, NES suggests entire refactorings or multi-line changes anywhere in your file - think of it as Copilot's \"big picture\" suggestions.\n\n## 📦 Installation\n\nInstall with your favorite manager. With [lazy.nvim](https:\u002F\u002Fgithub.com\u002Ffolke\u002Flazy.nvim):\n\n\u003C!-- setup_base:start -->\n\n```lua\n{\n  \"folke\u002Fsidekick.nvim\",\n  opts = {\n    -- add any options here\n    cli = {\n      mux = {\n        backend = \"zellij\",\n        enabled = true,\n      },\n    },\n  },\n  keys = {\n    {\n      \"\u003Ctab>\",\n      function()\n        -- if there is a next edit, jump to it, otherwise apply it if any\n        if not require(\"sidekick\").nes_jump_or_apply() then\n          return \"\u003CTab>\" -- fallback to normal tab\n        end\n      end,\n      expr = true,\n      desc = \"Goto\u002FApply Next Edit Suggestion\",\n    },\n    {\n      \"\u003Cc-.>\",\n      function() require(\"sidekick.cli\").focus() end,\n      desc = \"Sidekick Focus\",\n      mode = { \"n\", \"t\", \"i\", \"x\" },\n    },\n    {\n      \"\u003Cleader>aa\",\n      function() require(\"sidekick.cli\").toggle() end,\n      desc = \"Sidekick Toggle CLI\",\n    },\n    {\n      \"\u003Cleader>as\",\n      function() require(\"sidekick.cli\").select() end,\n      -- Or to select only installed tools:\n      -- require(\"sidekick.cli\").select({ filter = { installed = true } })\n      desc = \"Select CLI\",\n    },\n    {\n      \"\u003Cleader>ad\",\n      function() require(\"sidekick.cli\").close() end,\n      desc = \"Detach a CLI Session\",\n    },\n    {\n      \"\u003Cleader>at\",\n      function() require(\"sidekick.cli\").send({ msg = \"{this}\" }) end,\n      mode = { \"x\", \"n\" },\n      desc = \"Send This\",\n    },\n    {\n      \"\u003Cleader>af\",\n      function() require(\"sidekick.cli\").send({ msg = \"{file}\" }) end,\n      desc = \"Send File\",\n    },\n    {\n      \"\u003Cleader>av\",\n      function() require(\"sidekick.cli\").send({ msg = \"{selection}\" }) end,\n      mode = { \"x\" },\n      desc = \"Send Visual Selection\",\n    },\n    {\n      \"\u003Cleader>ap\",\n      function() require(\"sidekick.cli\").prompt() end,\n      mode = { \"n\", \"x\" },\n      desc = \"Sidekick Select Prompt\",\n    },\n    -- Example of a keybinding to open Claude directly\n    {\n      \"\u003Cleader>ac\",\n      function() require(\"sidekick.cli\").toggle({ name = \"claude\", focus = true }) end,\n      desc = \"Sidekick Toggle Claude\",\n    },\n  },\n}\n```\n\n\u003C!-- setup_base:end -->\n\n> [!TIP]\n> It's a good idea to run `:checkhealth sidekick` after install.\n\n\u003Cdetails>\n  \u003Csummary>Integrate \u003Ccode>&lt;Tab&gt;\u003C\u002Fcode> in insert mode with \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fsaghen\u002Fblink.cmp\">blink.cmp\u003C\u002Fa>\u003C\u002Fsummary>\n\n\u003C!-- setup_blink:start -->\n\n```lua\n{\n  \"saghen\u002Fblink.cmp\",\n  ---@module 'blink.cmp'\n  ---@type blink.cmp.Config\n  opts = {\n\n    keymap = {\n      [\"\u003CTab>\"] = {\n        \"snippet_forward\",\n        function() -- sidekick next edit suggestion\n          return require(\"sidekick\").nes_jump_or_apply()\n        end,\n        function() -- if you are using Neovim's native inline completions\n          return vim.lsp.inline_completion.get()\n        end,\n        \"fallback\",\n      },\n    },\n  },\n}\n```\n\n\u003C!-- setup_blink:end -->\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n  \u003Csummary>Custom \u003Ccode>&lt;Tab&gt;\u003C\u002Fcode> integration for \u003Cb>insert mode\u003C\u002Fb>\u003C\u002Fsummary>\n\n\u003C!-- setup_custom:start -->\n\n```lua\n{\n  \"folke\u002Fsidekick.nvim\",\n  opts = {\n    -- add any options here\n  },\n  keys = {\n    {\n      \"\u003Ctab>\",\n      function()\n        -- if there is a next edit, jump to it, otherwise apply it if any\n        if require(\"sidekick\").nes_jump_or_apply() then\n          return -- jumped or applied\n        end\n\n        -- if you are using Neovim's native inline completions\n        if vim.lsp.inline_completion.get() then\n          return\n        end\n\n        -- any other things (like snippets) you want to do on \u003Ctab> go here.\n\n        -- fall back to normal tab\n        return \"\u003Ctab>\"\n      end,\n      mode = { \"i\", \"n\" },\n      expr = true,\n      desc = \"Goto\u002FApply Next Edit Suggestion\",\n    },\n  },\n}\n```\n\n\u003C!-- setup_custom:end -->\n\n\u003C\u002Fdetails>\n\nAfter installation sign in with `:LspCopilotSignIn` if prompted.\n\n## ⚙️ Configuration\n\nThe module ships with safe defaults and exposes everything through\n`require(\"sidekick\").setup({ ... })`.\n\n\u003Cdetails>\n\u003Csummary>Default settings\u003C\u002Fsummary>\n\n\u003C!-- config:start -->\n\n```lua\n---@class sidekick.Config\nlocal defaults = {\n  nes = {\n    ---@type boolean|fun(buf:integer):boolean?\n    enabled = function(buf)\n      return vim.g.sidekick_nes ~= false and vim.b.sidekick_nes ~= false\n    end,\n    debounce = 100,\n    trigger = {\n      -- events that trigger sidekick next edit suggestions\n      events = { \"ModeChanged i:n\", \"TextChanged\", \"User SidekickNesDone\" },\n    },\n    clear = {\n      -- events that clear the current next edit suggestion\n      events = { \"TextChangedI\", \"InsertEnter\" },\n      esc = true, -- clear next edit suggestions when pressing \u003CEsc>\n    },\n    ---@class sidekick.diff.Opts\n    ---@field inline? \"words\"|\"chars\"|false Enable inline diffs\n    ---@field show? \"always\"|\"cursor\" `cursor` will only show the diff when the cursor is at the edit position.\n    diff = {\n      inline = \"words\",\n      show = \"always\",\n    },\n    signs = true, -- show signs for next edit suggestions\n    jumplist = true, -- add an entry to the jumplist\n  },\n  -- Work with AI cli tools directly from within Neovim\n  cli = {\n    watch = true, -- notify Neovim of file changes done by AI CLI tools\n    ---@class sidekick.win.Opts\n    win = {\n      --- This is run when a new terminal is created, before starting it.\n      --- Here you can change window options `terminal.opts`.\n      ---@param terminal sidekick.cli.Terminal\n      config = function(terminal) end,\n      wo = {}, ---@type vim.wo\n      bo = {}, ---@type vim.bo\n      layout = \"right\", ---@type \"float\"|\"left\"|\"bottom\"|\"top\"|\"right\"\n      --- Options used when layout is \"float\"\n      ---@type vim.api.keyset.win_config\n      float = {\n        width = 0.9,\n        height = 0.9,\n      },\n      -- Options used when layout is \"left\"|\"bottom\"|\"top\"|\"right\"\n      ---@type vim.api.keyset.win_config\n      split = {\n        width = 80, -- set to 0 for default split width\n        height = 20, -- set to 0 for default split height\n      },\n      --- CLI Tool Keymaps (default mode is `t`)\n      ---@type table\u003Cstring, sidekick.cli.Keymap|false>\n      keys = {\n        buffers       = { \"\u003Cc-b>\", \"buffers\"   , mode = \"nt\", desc = \"open buffer picker\" },\n        files         = { \"\u003Cc-f>\", \"files\"     , mode = \"nt\", desc = \"open file picker\" },\n        hide_n        = { \"q\"    , \"hide\"      , mode = \"n\" , desc = \"hide the terminal window\" },\n        hide_ctrl_q   = { \"\u003Cc-q>\", \"hide\"      , mode = \"n\" , desc = \"hide the terminal window\" },\n        hide_ctrl_dot = { \"\u003Cc-.>\", \"hide\"      , mode = \"nt\", desc = \"hide the terminal window\" },\n        hide_ctrl_z   = { \"\u003Cc-z>\", \"blur\"      , mode = \"nt\", desc = \"go back to the previous window without hiding the terminal\" },\n        prompt        = { \"\u003Cc-p>\", \"prompt\"    , mode = \"t\" , desc = \"insert prompt or context\" },\n        stopinsert    = { \"\u003Cc-q>\", \"stopinsert\", mode = \"t\" , desc = \"enter normal mode\" },\n        -- Navigate windows in terminal mode. Only active when:\n        -- * layout is not \"float\"\n        -- * there is another window in the direction\n        -- With the default layout of \"right\", only `\u003Cc-h>` will be mapped\n        nav_left      = { \"\u003Cc-h>\", \"nav_left\"  , expr = true, desc = \"navigate to the left window\" },\n        nav_down      = { \"\u003Cc-j>\", \"nav_down\"  , expr = true, desc = \"navigate to the below window\" },\n        nav_up        = { \"\u003Cc-k>\", \"nav_up\"    , expr = true, desc = \"navigate to the above window\" },\n        nav_right     = { \"\u003Cc-l>\", \"nav_right\" , expr = true, desc = \"navigate to the right window\" },\n      },\n      ---@type fun(dir:\"h\"|\"j\"|\"k\"|\"l\")?\n      --- Function that handles navigation between windows.\n      --- Defaults to `vim.cmd.wincmd`. Used by the `nav_*` keymaps.\n      nav = nil,\n    },\n    ---@class sidekick.cli.Mux\n    ---@field backend? \"tmux\"|\"zellij\" Multiplexer backend to persist CLI sessions\n    mux = {\n      backend = vim.env.ZELLIJ and \"zellij\" or \"tmux\", -- default to tmux unless zellij is detected\n      enabled = false,\n      -- terminal: new sessions will be created for each CLI tool and shown in a Neovim terminal\n      -- window: when run inside a terminal multiplexer, new sessions will be created in a new tab\n      -- split: when run inside a terminal multiplexer, new sessions will be created in a new split\n      -- NOTE: zellij only supports `terminal`\n      create = \"terminal\", ---@type \"terminal\"|\"window\"|\"split\"\n      split = {\n        vertical = true, -- vertical or horizontal split\n        size = 0.5, -- size of the split (0-1 for percentage)\n      },\n    },\n    --- Actual cli tool config is loaded from the runtime path `sk\u002Fcli\u002F{tool}.lua` and merged with the config below.\n    --- For default configs, see https:\u002F\u002Fgithub.com\u002Ffolke\u002Fsidekick.nvim\u002Ftree\u002Fmain\u002Fsk\u002Fcli\n    ---@type table\u003Cstring, sidekick.cli.Config|{}>\n    tools = {\n      aider    = {},\n      amazon_q = {},\n      claude   = {},\n      codex    = {},\n      copilot  = {},\n      crush    = {},\n      cursor   = {},\n      gemini   = {},\n      grok     = {},\n      opencode = {},\n      pi       = {},\n      qwen     = {},\n    },\n    --- Add custom context. See `lua\u002Fsidekick\u002Fcontext\u002Finit.lua`\n    ---@type table\u003Cstring, sidekick.context.Fn>\n    context = {},\n    ---@type table\u003Cstring, sidekick.Prompt|string|fun(ctx:sidekick.context.ctx):(string?)>\n    prompts = {\n      changes         = \"Can you review my changes?\",\n      diagnostics     = \"Can you help me fix the diagnostics in {file}?\\n{diagnostics}\",\n      diagnostics_all = \"Can you help me fix these diagnostics?\\n{diagnostics_all}\",\n      document        = \"Add documentation to {function|line}\",\n      explain         = \"Explain {this}\",\n      fix             = \"Can you fix {this}?\",\n      optimize        = \"How can {this} be optimized?\",\n      review          = \"Can you review {file} for any issues or improvements?\",\n      tests           = \"Can you write tests for {this}?\",\n      -- simple context prompts\n      buffers         = \"{buffers}\",\n      file            = \"{file}\",\n      line            = \"{line}\",\n      position        = \"{position}\",\n      quickfix        = \"{quickfix}\",\n      selection       = \"{selection}\",\n      [\"function\"]    = \"{function}\",\n      class           = \"{class}\",\n    },\n    -- preferred picker for selecting files\n    ---@alias sidekick.picker \"snacks\"|\"telescope\"|\"fzf-lua\"\n    picker = \"snacks\", ---@type sidekick.picker\n  },\n  copilot = {\n    -- track copilot's status with `didChangeStatus`\n    status = {\n      enabled = true,\n      level = vim.log.levels.WARN,\n      -- set to vim.log.levels.OFF to disable notifications\n      -- level = vim.log.levels.OFF,\n    },\n  },\n  ui = {\n    icons = {\n      nes               = \" \",\n      attached          = \" \",\n      started           = \" \",\n      installed         = \" \",\n      missing           = \" \",\n      external_attached = \"󰖩 \",\n      external_started  = \"󰖪 \",\n      terminal_attached = \" \",\n      terminal_started  = \" \",\n    },\n  },\n  debug = false, -- enable debug logging\n}\n```\n\n\u003C!-- config:end -->\n\n\u003C\u002Fdetails>\n\n## ✏️ Next Edit Suggestions (NES)\n\nCopilot NES requests run automatically when you leave insert mode,\nmodify text in normal mode, or after applying an edit.\n\n\u003C!-- api_nes:start -->\n\n\u003Ctable>\u003Ctr>\u003Cth>Cmd\u003C\u002Fth>\u003Cth>Lua\u003C\u002Fth>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Ccode>:Sidekick nes apply\u003C\u002Fcode> Apply active text edits\u003C\u002Ftd>\u003Ctd>\n\n\n```lua\n---@return boolean applied\nrequire(\"sidekick.nes\").apply()\n```\n\n\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Ccode>:Sidekick nes clear\u003C\u002Fcode> Clear all active edits\u003C\u002Ftd>\u003Ctd>\n\n\n```lua\nrequire(\"sidekick.nes\").clear()\n```\n\n\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Ccode>:Sidekick nes disable\u003C\u002Fcode> \u003C\u002Ftd>\u003Ctd>\n\n\n```lua\n\nrequire(\"sidekick.nes\").disable()\n```\n\n\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Ccode>:Sidekick nes enable\u003C\u002Fcode> \u003C\u002Ftd>\u003Ctd>\n\n\n```lua\n---@param enable? boolean\nrequire(\"sidekick.nes\").enable(enable)\n```\n\n\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd> Check if any edits are active in the current buffer\u003C\u002Ftd>\u003Ctd>\n\n\n```lua\nrequire(\"sidekick.nes\").have()\n```\n\n\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Ccode>:Sidekick nes jump\u003C\u002Fcode> Jump to the start of the active edit\u003C\u002Ftd>\u003Ctd>\n\n\n```lua\n---@return boolean jumped\nrequire(\"sidekick.nes\").jump()\n```\n\n\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Ccode>:Sidekick nes toggle\u003C\u002Fcode> \u003C\u002Ftd>\u003Ctd>\n\n\n```lua\n\nrequire(\"sidekick.nes\").toggle()\n```\n\n\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Ccode>:Sidekick nes update\u003C\u002Fcode> Request new edits from the LSP server (if any)\u003C\u002Ftd>\u003Ctd>\n\n\n```lua\nrequire(\"sidekick.nes\").update()\n```\n\n\u003C\u002Ftd>\u003C\u002Ftr>\n\u003C\u002Ftable>\n\n\u003C!-- api_nes:end -->\n\n## 🤖 AI CLI Integration\n\nSidekick ships with a lightweight terminal wrapper so you can talk to local AI CLI\ntools without leaving Neovim. Each tool runs in its own scratch terminal window and\nshares helper prompts that bundle buffer context, the current cursor position, and\ndiagnostics when requested.\n\n\u003C!-- api_cli:start -->\n\n\u003Ctable>\u003Ctr>\u003Cth>Cmd\u003C\u002Fth>\u003Cth>Lua\u003C\u002Fth>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Ccode>:Sidekick cli close\u003C\u002Fcode> \u003C\u002Ftd>\u003Ctd>\n\n\n```lua\n---@param opts? sidekick.cli.Hide\n---@overload fun(name: string)\nrequire(\"sidekick.cli\").close(opts)\n```\n\n\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Ccode>:Sidekick cli focus\u003C\u002Fcode> Toggle focus of the terminal window if it is already open\u003C\u002Ftd>\u003Ctd>\n\n\n```lua\n---@param opts? sidekick.cli.Show\n---@overload fun(name: string)\nrequire(\"sidekick.cli\").focus(opts)\n```\n\n\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Ccode>:Sidekick cli hide\u003C\u002Fcode> \u003C\u002Ftd>\u003Ctd>\n\n\n```lua\n---@param opts? sidekick.cli.Hide\n---@overload fun(name: string)\nrequire(\"sidekick.cli\").hide(opts)\n```\n\n\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Ccode>:Sidekick cli prompt\u003C\u002Fcode> Select a prompt to send\u003C\u002Ftd>\u003Ctd>\n\n\n```lua\n---@param opts? sidekick.cli.Prompt|{cb:nil}\n---@overload fun(cb:fun(msg?:string))\nrequire(\"sidekick.cli\").prompt(opts)\n```\n\n\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd> Render a message template or prompt\u003C\u002Ftd>\u003Ctd>\n\n\n```lua\n---@param opts? sidekick.cli.Message|string\nrequire(\"sidekick.cli\").render(opts)\n```\n\n\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Ccode>:Sidekick cli select\u003C\u002Fcode> Start or attach to a CLI tool\u003C\u002Ftd>\u003Ctd>\n\n\n```lua\n---@param opts? sidekick.cli.Select|{cb:nil}|{focus?:boolean}\n---@overload fun(cb:fun(state?:sidekick.cli.State))\nrequire(\"sidekick.cli\").select(opts)\n```\n\n\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Ccode>:Sidekick cli send\u003C\u002Fcode> Send a message or prompt to a CLI\u003C\u002Ftd>\u003Ctd>\n\n\n```lua\n---@param opts? sidekick.cli.Send\n---@overload fun(msg:string)\nrequire(\"sidekick.cli\").send(opts)\n```\n\n\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Ccode>:Sidekick cli show\u003C\u002Fcode> \u003C\u002Ftd>\u003Ctd>\n\n\n```lua\n---@param opts? sidekick.cli.Show\n---@overload fun(name: string)\nrequire(\"sidekick.cli\").show(opts)\n```\n\n\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>\u003Ccode>:Sidekick cli toggle\u003C\u002Fcode> \u003C\u002Ftd>\u003Ctd>\n\n\n```lua\n---@param opts? sidekick.cli.Show\n---@overload fun(name: string)\nrequire(\"sidekick.cli\").toggle(opts)\n```\n\n\u003C\u002Ftd>\u003C\u002Ftr>\n\u003C\u002Ftable>\n\n\u003C!-- api_cli:end -->\n\n### Prompts & Context\n\nSidekick comes with a set of predefined prompts that you can use with your AI tools.\nYou can also use context variables in your prompts to include information about the\ncurrent file, selection, diagnostics, and more.\n\n\u003Cimg width=\"1431\" height=\"723\" alt=\"image\" src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F652867ec-f34e-4036-9b0b-8a4817cc8722\" \u002F>\n\n\u003Cdetails>\u003Csummary>\u003Cstrong>Available Prompts\u003C\u002Fstrong>\u003C\u002Fsummary>\n\n- **changes**: `Can you review my changes?`\n- **diagnostics**: `Can you help me fix the diagnostics in {file}?\\n{diagnostics}`\n- **diagnostics_all**: `Can you help me fix these diagnostics?\\n{diagnostics_all}`\n- **document**: `Add documentation to {position}`\n- **explain**: `Explain {this}`\n- **fix**: `Can you fix {this}?`\n- **optimize**: `How can {this} be optimized?`\n- **review**: `Can you review {file} for any issues or improvements?`\n- **tests**: `Can you write tests for {this}?`\n- **quickfix**: `{quickfix}` (current quickfix entries).\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>\u003Cstrong>Available Context Variables\u003C\u002Fstrong>\u003C\u002Fsummary>\n\n- `{buffers}`: A list of all open buffers.\n- `{file}`: The current file path.\n- `{position}`: The cursor position in the current file.\n- `{line}`: The current line.\n- `{selection}`: The visual selection.\n- `{diagnostics}`: The diagnostics for the current buffer.\n- `{diagnostics_all}`: All diagnostics in the workspace.\n- `{quickfix}`: The current quickfix list, including title and formatted items.\n- `{function}`: The function at cursor (Tree-sitter) - returns location like `function foo @file:10:5`.\n- `{class}`: The class\u002Fstruct at cursor (Tree-sitter) - returns location.\n- `{this}`: A special context variable. If the current buffer is a file, it resolves to `{position}`. Otherwise, it resolves to the literal string \"this\" and appends the current `{selection}` to the prompt.\n\n\u003C\u002Fdetails>\n\n### Snacks.nvim Picker Integration\n\nIf you're using [snacks.nvim](https:\u002F\u002Fgithub.com\u002Ffolke\u002Fsnacks.nvim), you can send picker selections directly to Sidekick's AI CLI tools. This is useful for sending search results, grep matches, or file selections as context.\n\n\u003Cdetails>\u003Csummary>Example Snacks picker configuration\u003C\u002Fsummary>\n\n\u003C!-- snacks_picker:start -->\n\n```lua\n{\n  \"folke\u002Fsnacks.nvim\",\n  optional = true,\n  opts = {\n    picker = {\n      actions = {\n        sidekick_send = function(...)\n          return require(\"sidekick.cli.picker.snacks\").send(...)\n        end,\n      },\n      win = {\n        input = {\n          keys = {\n            [\"\u003Ca-a>\"] = {\n              \"sidekick_send\",\n              mode = { \"n\", \"i\" },\n            },\n          },\n        },\n      },\n    },\n  },\n}\n```\n\n\u003C!-- snacks_picker:end -->\n\nWith this configuration, pressing `\u003Ca-a>` in any Snacks picker will send the selected items to your current AI CLI session. The integration automatically handles:\n\n- File selections with full paths\n- Grep results with line numbers and positions\n- Multiple selections (sends all selected items)\n- Position ranges for precise context\n\n\u003C\u002Fdetails>\n\n### CLI Keymaps\n\nYou can customize the keymaps for the CLI window by setting the `cli.win.keys` option.\nThe default keymaps are:\n\n- `q` (in normal mode): Hide the terminal window.\n- `\u003Cc-q>` (in terminal mode): Hide the terminal window.\n- `\u003Cc-z>`: Leave the CLI window.\n- `\u003Cc-p>`: Insert prompt or context.\n\n\u003Cdetails>\u003Csummary>Example of how to override the default keymaps\n\u003C\u002Fsummary>\n\n```lua\n{\n  \"folke\u002Fsidekick.nvim\",\n  opts = {\n    cli = {\n      win = {\n        keys = {\n          -- override the default hide keymap\n          hide_n = { \"\u003Cleader>q\", \"hide\", mode = \"n\" },\n          -- add a new keymap to say hi\n          say_hi = {\n            \"\u003Cc-h>\",\n            function(t)\n              t:send(\"hi!\")\n            end,\n          },\n        },\n      },\n    },\n  },\n}\n```\n\n\u003C\u002Fdetails>\n\n### Default CLI tools\n\nSidekick preconfigures popular AI CLIs. Run `:checkhealth sidekick` to see which ones are installed.\n\n| Tool                                                        | Description          | Installation                                                                                                           |\n| ----------------------------------------------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------- |\n| [`aider`](https:\u002F\u002Fgithub.com\u002FAider-AI\u002Faider)                | AI pair programmer   | `pip install aider-chat` or `pipx install aider-chat`                                                                  |\n| [`amazon_q`](https:\u002F\u002Fgithub.com\u002Faws\u002Famazon-q-developer-cli) | Amazon Q Developer   | [Install guide](https:\u002F\u002Fdocs.aws.amazon.com\u002Famazonq\u002Flatest\u002Fqdeveloper-ug\u002Fcommand-line-getting-started-installing.html) |\n| [`claude`](https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fclaude-code)       | Claude Code CLI      | [See Claude Code docs](https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fen\u002Foverview#get-started)\n| [`codex`](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fcodex)                  | OpenAI Codex CLI     | See [OpenAI docs](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fcodex)                                                                     |\n| [`copilot`](https:\u002F\u002Fgithub.com\u002Fgithub\u002Fcopilot-cli)          | GitHub Copilot CLI   | `npm install -g @githubnext\u002Fgithub-copilot-cli`                                                                        |\n| [`crush`](https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fcrush)           | Charm's AI assistant | See [installation](https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fcrush)                                                             |\n| [`cursor`](https:\u002F\u002Fcursor.com\u002Fcli)                          | Cursor CLI agent     | See [Cursor docs](https:\u002F\u002Fcursor.com\u002Fcli)                                                                              |\n| [`gemini`](https:\u002F\u002Fgithub.com\u002Fgoogle-gemini\u002Fgemini-cli)     | Google Gemini CLI    | See [repo](https:\u002F\u002Fgithub.com\u002Fgoogle-gemini\u002Fgemini-cli)                                                                |\n| [`grok`](https:\u002F\u002Fgithub.com\u002Fsuperagent-ai\u002Fgrok-cli)         | xAI Grok CLI         | See [repo](https:\u002F\u002Fgithub.com\u002Fsuperagent-ai\u002Fgrok-cli)                                                                  |\n| [`opencode`](https:\u002F\u002Fgithub.com\u002Fsst\u002Fopencode)               | OpenCode CLI         | `npm install -g opencode`                                                                                              |\n| [`qwen`](https:\u002F\u002Fgithub.com\u002FQwenLM\u002Fqwen-code)               | Alibaba Qwen Code    | See [repo](https:\u002F\u002Fgithub.com\u002FQwenLM\u002Fqwen-code)                                                                        |\n\n> [!TIP]\n> After installing tools, restart Neovim or run `:Sidekick cli select` to see them available.\n\n## 🚀 Commands\n\nSidekick provides a `:Sidekick` command that allows you to interact with the plugin\nfrom the command line. The command is a thin wrapper around the Lua API, so you\ncan use it to do anything that the Lua API can do.\n\n### Command Structure\n\nThe command structure is simple:\n\n```\n:Sidekick \u003Cmodule> \u003Ccommand> [args]\n```\n\n- `\u003Cmodule>`: The name of the module you want to use (e.g., `nes`, `cli`).\n- `\u003Ccommand>`: The name of the command you want to execute.\n- `[args]`: Optional arguments for the command. The arguments are parsed as a Lua\n  table.\n\nFor example, to show the CLI window for the `claude` tool, you can use the\nfollowing command:\n\n```\n:Sidekick cli show name=claude\n```\n\nThis is equivalent to the following Lua code:\n\n```lua\nrequire(\"sidekick.cli\").show({ name = \"claude\" })\n```\n\n\u003Cdetails>\u003Csummary>\n\u003Cstrong>Available Commands\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nHere's a list of the available commands:\n\n**NES (`nes`)**\n\n- `enable`: Enable Next Edit Suggestions.\n- `disable`: Disable Next Edit Suggestions.\n- `toggle`: Toggle Next Edit Suggestions.\n- `update`: Trigger a new suggestion.\n- `clear`: Clear the current suggestion.\n\n**CLI (`cli`)**\n\n- `show`: Show the CLI window.\n- `toggle`: Toggle the CLI window.\n- `hide`: Hide the CLI window.\n- `close`: Close the CLI window.\n- `focus`: Focus the CLI window.\n- `select`: Select a CLI tool to open.\n- `send`: Send a message to the current CLI tool.\n- `prompt`: Select a prompt to send to the current CLI tool.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>\n\u003Cstrong>Examples\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nHere are some examples of how to use the `:Sidekick` command:\n\n- Toggle the CLI window:\n\n  ```\n  :Sidekick cli toggle\n  ```\n\n  Lua equivalent:\n\n  ```lua\n  require(\"sidekick.cli\").toggle()\n  ```\n\n- Send the visual selection to the current CLI tool:\n\n  ```\n  :'\u003C,'>Sidekick cli send msg=\"{selection}\"\n  ```\n\n  Lua equivalent:\n\n  ```lua\n  require(\"sidekick.cli\").send({ msg = \"{selection}\" })\n  ```\n\n- Show the CLI window for the `grok` tool and focus it:\n\n  ```\n  :Sidekick cli show name=grok focus=true\n  ```\n\n  Lua equivalent:\n\n  ```lua\n  require(\"sidekick.cli\").show({ name = \"grok\", focus = true })\n  ```\n\n  \u003C\u002Fdetails>\n\n## 📟 Statusline Integration\n\nUsing the `require(\"sidekick.status\")` API, you can easily integrate **Copilot LSP**\nand **CLI sessions** in your statusline.\n\n\u003Cdetails>\n\u003Csummary>Example for \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fnvim-lualine\u002Flualine.nvim\">lualine.nvim\u003C\u002Fa>\u003C\u002Fsummary>\n\n\u003C!-- setup_lualine:start -->\n\n```lua\n{\n  \"nvim-lualine\u002Flualine.nvim\",\n  opts = function(_, opts)\n    opts.sections = opts.sections or {}\n    opts.sections.lualine_c = opts.sections.lualine_c or {}\n\n    -- Copilot status\n    table.insert(opts.sections.lualine_c, {\n      function()\n        return \" \"\n      end,\n      color = function()\n        local status = require(\"sidekick.status\").get()\n        if status then\n          return status.kind == \"Error\" and \"DiagnosticError\" or status.busy and \"DiagnosticWarn\" or \"Special\"\n        end\n      end,\n      cond = function()\n        local status = require(\"sidekick.status\")\n        return status.get() ~= nil\n      end,\n    })\n\n    -- CLI session status\n    table.insert(opts.sections.lualine_x, 2, {\n      function()\n        local status = require(\"sidekick.status\").cli()\n        return \" \" .. (#status > 1 and #status or \"\")\n      end,\n      cond = function()\n        return #require(\"sidekick.status\").cli() > 0\n      end,\n      color = function()\n        return \"Special\"\n      end,\n    })\n  end,\n}\n```\n\n\u003C!-- setup_lualine:end -->\n\n\u003C\u002Fdetails>\n\n## ❓ FAQ\n\n### Does sidekick.nvim replace Copilot's inline suggestions?\n\nNo! NES complements inline suggestions. They serve different purposes:\n\n- **Inline completions**: Quick, as-you-type suggestions (use copilot.lua or native `vim.lsp.inline_completion`)\n- **NES**: Larger refactorings and multi-line changes after you pause\n\nYou'll want both for the best experience.\n\n### How is this different from copilot.lua or copilot.vim?\n\n`copilot.lua` and `copilot.vim` provide **inline completions** (suggestions as you type). `sidekick.nvim` adds:\n\n- **Next Edit Suggestions (NES)**: Multi-line refactorings and context-aware edits across your file\n- **AI CLI Integration**: Built-in terminal for Claude, Gemini, and other AI tools\n\nUse them together for the complete experience!\n\n### NES not showing suggestions?\n\n1. Run `:checkhealth sidekick` to verify your setup\n2. Check Copilot is signed in: `:LspCopilotSignIn`\n3. Verify the LSP is attached: `:lua vim.print(require(\"sidekick.config\").get_client())`\n4. Try manually triggering: `:Sidekick nes update`\n\n### CLI tools not starting?\n\n1. Verify the tool is installed: `which claude` (or your tool name)\n2. Check `:checkhealth sidekick` for tool installation status\n3. Try running the tool directly in your terminal first\n4. Check for errors with `:messages` after attempting to start\n\n### Terminal sessions not persisting?\n\nMake sure you have tmux or zellij installed and enable the multiplexer:\n\n```lua\nopts = {\n  cli = {\n    mux = {\n      enabled = true,\n      backend = \"tmux\", -- or \"zellij\"\n    },\n  },\n}\n```\n\n### Do I need a GitHub Copilot subscription?\n\nYes, but only for the **NES feature** (Next Edit Suggestions). The **AI CLI integration** works independently with any CLI tool (Claude, Gemini, etc.) and doesn't require Copilot.\n\n### Can I use this without NES, just for CLI tools?\n\nAbsolutely! Just disable NES:\n\n```lua\nopts = {\n  nes = { enabled = false },\n}\n```\n\n### Will this work with Neovim 0.10?\n\nNo, Neovim **>= 0.11.2** is required for the LSP features and API used by sidekick.nvim.\n\n### How do I add my own AI tool?\n\nAdd it to the `cli.tools` configuration:\n\n```lua\nopts = {\n  cli = {\n    tools = {\n      my_tool = {\n        cmd = { \"my-ai-cli\", \"--flag\" },\n        -- Optional: custom keymaps for this tool\n        keys = {\n          submit = { \"\u003Cc-s>\", function(t) t:send(\"\\n\") end },\n        },\n      },\n    },\n  },\n}\n```\n\n### How do I create custom prompts?\n\nAdd them to your config:\n\n```lua\nopts = {\n  cli = {\n    prompts = {\n      refactor = \"Please refactor {this} to be more maintainable\",\n      security = \"Review {file} for security vulnerabilities\",\n      custom = function(ctx)\n        return \"Current file: \" .. ctx.buf .. \" at line \" .. ctx.row\n      end,\n    },\n  },\n}\n```\n\nThen use with `\u003Cleader>ap` or `:Sidekick cli prompt`.\n","sidekick.nvim 是一个为 Neovim 设计的 AI 辅助插件，集成了 Copilot LSP 的“下一编辑建议”功能，并提供了一个内置终端来支持多种 AI 命令行工具。其核心功能包括自动获取编码建议、丰富的差异可视化展示以及逐段审查和应用代码修改的能力；同时，它还允许用户直接在编辑器内与各种流行的 AI 工具（如 Claude, Gemini, Codex 等）交互，实现智能提示和会话持久化等功能。此外，该插件提供了高度可定制化的配置选项及友好的 API 接口，方便与其他插件集成。适用于需要提高编程效率、减少上下文切换开销或希望通过 AI 辅助提升代码质量的开发者场景。",2,"2026-06-11 03:45:17","high_star"]