nvim-aider

nvim-aider

๐Ÿค– Seamlessly integrate Aider with Neovim for an enhanced AI-assisted coding experience!

Stars: 86

Visit
 screenshot

Nvim-aider is a plugin for Neovim that provides additional functionality and key mappings to enhance the user's editing experience. It offers features such as code navigation, quick access to commonly used commands, and improved text manipulation tools. With Nvim-aider, users can streamline their workflow and increase productivity while working with Neovim.

README:

aider nvim-aider

๐Ÿค– Seamlessly integrate Aider with Neovim for an enhanced AI-assisted coding experience!

screenshot_1

screenshot_2

๐Ÿšง 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] ๐Ÿ” Aider command selection UI with fuzzy search and input prompt
  • [x] ๐ŸŒณ Integration with nvim-tree.lua for adding or dropping files directly from the tree interface

๐ŸŽฎ Commands

  • ๐Ÿฉบ AiderHealth - Check if everything is working correctly
  • โŒจ๏ธ AiderTerminalToggle - Toggle the Aider terminal window
  • ๐Ÿ“ค AiderTerminalSend [text] - Send text to Aider
    • Without arguments: Opens input prompt
    • With arguments: Sends provided text directly
    • In visual mode: Sends selected text with an optional prompt
  • ๐Ÿ” AiderQuickSendCommand - List all Aider commands from ๐Ÿฟ Snacks picker with option to add prompt after selection
  • ๐Ÿ“ AiderQuickAddFile - Add current buffer file to Aider session
  • ๐Ÿ—‘๏ธ AiderQuickDropFile - Remove current buffer file from Aider session
  • ๐Ÿ“‹ AiderQuickSendBuffer - Send entire buffer content to Aider with an optional prompt
  • ๐Ÿ“š AiderQuickReadOnlyFile - Add current buffer as read-only reference file
  • ๐ŸŒณ AiderTreeAddReadOnlyFile - Add a read-only file from nvim-tree to Aider chat

๐Ÿ”— Requirements

๐Ÿ Python: Install aider-chat
๐Ÿ“‹ System: Neovim >= 0.9.4, Working clipboard thanks to @milanglacier
๐ŸŒ™ Lua: folke/snacks.nvim,
optionals catppuccin/nvim, nvim-tree.lua

๐Ÿ“ฆ Installation

Using lazy.nvim:

{
    "GeorgesAlkhouri/nvim-aider",
    cmd = {
      "AiderTerminalToggle", "AiderHealth",
    },
    keys = {
      { "<leader>a/", "<cmd>AiderTerminalToggle<cr>", desc = "Open Aider" },
      { "<leader>as", "<cmd>AiderTerminalSend<cr>", desc = "Send to Aider", mode = { "n", "v" } },
      { "<leader>ac", "<cmd>AiderQuickSendCommand<cr>", desc = "Send Command To Aider" },
      { "<leader>ab", "<cmd>AiderQuickSendBuffer<cr>", desc = "Send Buffer To Aider" },
      { "<leader>a+", "<cmd>AiderQuickAddFile<cr>", desc = "Add File to Aider" },
      { "<leader>a-", "<cmd>AiderQuickDropFile<cr>", desc = "Drop File from Aider" },
      { "<leader>ar", "<cmd>AiderQuickReadOnlyFile<cr>", desc = "Add File as Read-Only" },
      -- Example nvim-tree.lua integration if needed
      { "<leader>a+", "<cmd>AiderTreeAddFile<cr>", desc = "Add File from Tree to Aider", ft = "NvimTree" },
      { "<leader>a-", "<cmd>AiderTreeDropFile<cr>", 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",
    },
    config = true,
  }

โš™๏ธ Configuration

There is no need to call setup if you don't want to change the default options.

require("nvim_aider").setup({
  -- 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 = "bottom",
  },
})

Made with ๐Ÿค– using Aider

For Tasks:

Click tags to check more tools for each tasks

For Jobs:

Alternative AI tools for nvim-aider

Similar Open Source Tools

For similar tasks

For similar jobs