awesome-deepseek-integration/docs/codecompanion.nvim
2025-01-20 11:47:43 +08:00
..
README_cn.md doc: add olimorris/codecompanion.nvim 2025-01-20 11:47:43 +08:00
README.md doc: add olimorris/codecompanion.nvim 2025-01-20 11:47:43 +08:00

codecompanion.nvim

AI-powered coding, seamlessly in Neovim

codecompanion.nvim is a productivity tool which streamlines how you develop with LLMs, in Neovim.

Features

  • 💬 Copilot Chat meets Zed AI, in Neovim
  • 🔌 Support for Anthropic, Copilot, Gemini, Ollama, OpenAI, Azure OpenAI, HuggingFace and xAI LLMs (or bring your own!)
  • 🚀 Inline transformations, code creation and refactoring
  • 🤖 Variables, Slash Commands, Agents/Tools and Workflows to improve LLM output
  • Built in prompt library for common tasks like advice on LSP errors and code explanations
  • 🏗️ Create your own custom prompts, Variables and Slash Commands
  • 📚 Have multiple chats open at the same time
  • 💪 Async execution for fast performance

Installation

First, Navigate to the nvim configuration folder (default on Linux is ~/.config/nvim)

Install via lazy.nvim

Then to the lua/plugins folder. Create a file named init.lua and add the following content:

return {
  "olimorris/codecompanion.nvim",
  dependencies = {
    "nvim-lua/plenary.nvim",
    "nvim-treesitter/nvim-treesitter",
  },
  config = function()
    require("codecompanion").setup({
      adapters = {
        deepseek = function()
          return require("codecompanion.adapters").extend("openai_compatible", {
            env = {
              url = "https://api.deepseek.com",
              api_key = "YOUR_API_KEY",
            },
          })
        end,
      },
      strategies = {
        chat = { adapter = "deepseek", },
        inline = { adapter = "deepseek" },
        agent = { adapter = "deepseek" },
      },
    })
  end
}

Restart nvim, and lazy.nvim should automatically download and install the codecompanion.nvim plugin and its dependencies based on the above file.

Install via mini.deps

Add the following content to your init.lua:

local add, later = MiniDeps.add, MiniDeps.later

later(function()
  add({
    source = "olimorris/codecompanion.nvim",
    depends = {
      "nvim-lua/plenary.nvim",
      "nvim-treesitter/nvim-treesitter",
    },
  })
  require("codecompanion").setup({
    adapters = {
      deepseek = function()
        return require("codecompanion.adapters").extend("openai_compatible", {
          env = {
            url = "https://api.deepseek.com",
              api_key = "YOUR_API_KEY",
          },
        })
      end,
    },
    strategies = {
      chat = { adapter = "deepseek", },
      inline = { adapter = "deepseek" },
      agent = { adapter = "deepseek" },
    },
  })
end)

Restart nvim, and mini.deps should also automatically download and install the codecompanion.nvim plugin.

Other Installation Methods

https://codecompanion.olimorris.dev/installation.html

Usage

https://codecompanion.olimorris.dev/usage/introduction.html