https://github.com/GeorgesAlkhouri/nvim-aider
🤖 Seamlessly integrate Aider with Neovim for an enhanced AI-assisted coding experience!
https://github.com/GeorgesAlkhouri/nvim-aider
ai-coding aider lua neovim neovim-plugin terminal-integration
Last synced: 4 days ago
JSON representation
🤖 Seamlessly integrate Aider with Neovim for an enhanced AI-assisted coding experience!
- Host: GitHub
- URL: https://github.com/GeorgesAlkhouri/nvim-aider
- Owner: GeorgesAlkhouri
- License: mit
- Created: 2024-11-19T17:58:02.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-04-06T19:25:59.000Z (13 days ago)
- Last Synced: 2025-04-07T05:08:24.009Z (13 days ago)
- Topics: ai-coding, aider, lua, neovim, neovim-plugin, terminal-integration
- Language: Lua
- Homepage:
- Size: 113 KB
- Stars: 155
- Watchers: 2
- Forks: 12
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-neovim - GeorgesAlkhouri/nvim-aider - Seamlessly integrate Aider for an AI-assisted coding experience. (AI / (requires Neovim 0.5))
- awesome-neovim-sorted - GeorgesAlkhouri/nvim-aider - assisted coding experience! | (AI)
README
# [](https://aider.chat) nvim-aider
🤖 Seamlessly integrate Aider with Neovim for an enhanced AI-assisted coding experience!
![]()
> 🚧 This plugin is in initial development. Expect breaking changes and rough edges.
> _October 17, 2024_## 🌟 Features
- [x] 🖥️ Aider terminal integration within Neovim
- [x] 🎨 Color theme configuration support with auto Catppuccin flavor synchronization
if available
- [x] 📤 Quick commands to add/drop current buffer files
- [x] 📤 Send buffers or selections to Aider
- [x] 💬 Optional user prompt for buffer and selection sends
- [x] 🩺 Send current buffer diagnostics to Aider
- [x] 🔍 Aider command selection UI with fuzzy search and input prompt
- [x] 🔌 Fully documented [Lua API](lua/nvim_aider/api.lua) for
programmatic interaction and custom integrations
- [x] 🌲➕ [Neo-tree](https://github.com/nvim-neo-tree/neo-tree.nvim)
integration also with multi-file/directory selection with visual mode support
- [x] 🌳 Integration with [nvim-tree.lua](https://github.com/nvim-tree/nvim-tree.lua)
for adding or dropping files directly from the tree interface## 🎮 Commands
- `:Aider` - Open interactive command menu
```text
Commands:
health 🩺 Check plugin health status
toggle 🎛️ Toggle Aider terminal window
send 📤 Send text to Aider (prompt if empty)
command ⌨️ Show slash commands
buffer 📄 Send current buffer
> diagnostics 🩺 Send current buffer diagnostics
add ➕ Add file to session
> readonly 👀 Add as read-only reference
drop 🗑️ Remove file from session
```- ⚡ Direct command execution examples:
```vim
:Aider health
:Aider add readonly
:Aider send "Fix login validation"
```## 🔗 Requirements
🐍 Python: Install `aider-chat`
📋 System: **Neovim** >= 0.9.4, ~~Working clipboard~~ thanks to @milanglacier
🌙 Lua: `folke/snacks.nvim`,
_optionals_ `catppuccin/nvim`, `nvim-neo-tree/neo-tree.nvim`, `nvim-tree.lua`## 📦 Installation
Using lazy.nvim:
```lua
{
"GeorgesAlkhouri/nvim-aider",
cmd = "Aider",
-- Example key mappings for common actions:
keys = {
{ "a/", "Aider toggle", desc = "Toggle Aider" },
{ "as", "Aider send", desc = "Send to Aider", mode = { "n", "v" } },
{ "ac", "Aider command", desc = "Aider Commands" },
{ "ab", "Aider buffer", desc = "Send Buffer" },
{ "a+", "Aider add", desc = "Add File" },
{ "a-", "Aider drop", desc = "Drop File" },
{ "ar", "Aider add readonly", desc = "Add Read-Only" },
-- Example nvim-tree.lua integration if needed
{ "a+", "AiderTreeAddFile", desc = "Add File from Tree to Aider", ft = "NvimTree" },
{ "a-", "AiderTreeDropFile", desc = "Drop File from Tree from Aider", ft = "NvimTree" },
},
dependencies = {
"folke/snacks.nvim",
--- The below dependencies are optional
"catppuccin/nvim",
"nvim-tree/nvim-tree.lua",
--- Neo-tree integration
{
"nvim-neo-tree/neo-tree.nvim",
opts = function(_, opts)
-- Example mapping configuration (already set by default)
-- opts.window = {
-- mappings = {
-- ["+"] = { "nvim_aider_add", desc = "add to aider" },
-- ["-"] = { "nvim_aider_drop", desc = "drop from aider" }
-- }
-- }
require("nvim_aider.neo_tree").setup(opts)
end,
},
},
config = true,
}
```## ⚙️ Configuration
There is no need to call setup if you don't want to change the default options.
```lua
require("nvim_aider").setup({
-- Command that executes Aider
aider_cmd = "aider",
-- Command line arguments passed to aider
args = {
"--no-auto-commits",
"--pretty",
"--stream",
},
-- Theme colors (automatically uses Catppuccin flavor if available)
theme = {
user_input_color = "#a6da95",
tool_output_color = "#8aadf4",
tool_error_color = "#ed8796",
tool_warning_color = "#eed49f",
assistant_output_color = "#c6a0f6",
completion_menu_color = "#cad3f5",
completion_menu_bg_color = "#24273a",
completion_menu_current_color = "#181926",
completion_menu_current_bg_color = "#f4dbd6",
},
-- snacks.picker.layout.Config configuration
picker_cfg = {
preset = "vscode",
},
-- Other snacks.terminal.Opts options
config = {
os = { editPreset = "nvim-remote" },
gui = { nerdFontsVersion = "3" },
},
win = {
wo = { winbar = "Aider" },
style = "nvim_aider",
position = "right",
},
})
```## 📚 API Reference
The plugin provides a structured API for programmatic integration. Access via `require("nvim_aider").api`
### Core Functions
```lua
local api = require("nvim_aider").api
```#### `health_check()`
Verify plugin health status
```lua
api.health_check()
```#### `toggle_terminal(opts?)`
Toggle Aider terminal window
```lua
api.toggle_terminal()
```---
### Terminal Operations
#### `send_to_terminal(text, opts?)`
Send raw text directly to Aider
```lua
api.send_to_terminal("Fix the login validation")
```#### `send_command(command, input?, opts?)`
Execute specific Aider command
```lua
api.send_command("/commit", "Add error handling")
```---
### File Management
#### `add_file(filepath)`
Add specific file to session
```lua
api.add_file("/src/utils.lua")
```#### `drop_file(filepath)`
Remove file from session
```lua
api.drop_file("/outdated/legacy.py")
```#### `add_current_file()`
Add current buffer's file (uses `add_file` internally)
```lua
vim.api.nvim_create_autocmd("BufWritePost", {
callback = function()
api.add_current_file()
end
})
```#### `drop_current_file()`
Remove current buffer's file
```lua
api.drop_current_file()
```#### `add_read_only_file()`
Add current buffer as read-only reference
```lua
api.add_read_only_file()
```---
### Buffer Operations
#### `send_buffer_with_prompt(opts?)`
Send entire buffer content with optional prompt
```lua
api.send_buffer_with_prompt()
```#### `send_diagnostics_with_prompt(opts?)`
Send current buffer's diagnostics with an optional prompt
```lua
api.send_diagnostics_with_prompt()
```---
### UI Components
#### `open_command_picker(opts?, callback?)`
Interactive command selector with custom handling
```lua
api.open_command_picker(nil, function(picker, item)
if item.text == "/custom" then
-- Implement custom command handling
else
-- Default behavior
picker:close()
api.send_command(item.text)
end
end)
```---
## 🧩 Other Aider Neovim plugins
- [aider.nvim](https://github.com/joshuavial/aider.nvim)
- [aider.vim](https://github.com/nekowasabi/aider.vim)---