Skip to content

neovim plugin to get AI-powered (llm) code explanation & assistance directly in the editor. fast and simple.

Notifications You must be signed in to change notification settings

sr1jan/codepartner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodePartner.nvim

CodePartner is a Neovim plugin that provides AI-powered code explanations and assistance directly in your editor.

Features

  • Explain selected code snippets
  • Follow-up questions and conversations about your code
  • Customizable floating window for explanations
Screen.Recording.2024-08-26.at.2.25.30.AM.mov

Requirements

  • Neovim >= 0.7.0
  • Python 3.7+
  • Flask
  • llm >= 0.14

Installation

Here are several ways to install CodePartner.nvim:

use {
  'sr1/codepartner.nvim',
  config = function()
    require('codepartner').setup({
      api_key = 'your_api_key_here',
      server_url = 'http://localhost:5000'  -- Adjust if needed
      auto_start_server = true  -- Set to false if you want to start the server manually
    })
  end
}

Using vim-plug

Add the following to your init.vim:

Plug 'sr1/codepartner.nvim'

" After plug#end():
lua << EOF
require('codepartner').setup({
  api_key = 'your_api_key_here',
  server_url = 'http://localhost:5000'  -- Adjust if needed
  auto_start_server = true  -- Set to false if you want to start the server manually
})
EOF

Using dein.vim

Add the following to your init.vim:

call dein#add('sr1/codepartner.nvim')

" After dein#end():
lua << EOF
require('codepartner').setup({
  api_key = 'your_api_key_here',
  server_url = 'http://localhost:5000'  -- Adjust if needed
  auto_start_server = true  -- Set to false if you want to start the server manually
})
EOF

Using lazy.nvim

Add the following to your Neovim configuration:

{
  'sr1/codepartner.nvim',
  config = function()
    require('codepartner').setup({
      api_key = 'your_api_key_here',
      server_url = 'http://localhost:5000'  -- Adjust if needed
      auto_start_server = true  -- Set to false if you want to start the server manually
    })
  end
}

Manual Installation

If you prefer to manually install the plugin:

  1. Clone the repository:
    git clone https://github.com/sr1/codepartner.nvim.git \
      ~/.local/share/nvim/site/pack/plugins/start/codepartner.nvim
    
  2. Add the following to your init.lua:
    require('codepartner').setup({
      api_key = 'your_api_key_here',
      server_url = 'http://localhost:5000'  -- Adjust if needed
      auto_start_server = true  -- Set to false if you want to start the server manually
    })

Usage

  1. Select the code you want to explain in visual mode
  2. Run :ExplainSelection to get an explanation
  3. Use <Leader>et to toggle the explanation window
  4. Use <Leader>ec to close the explanation window

Configuration

You can customize the plugin by passing options to the setup function:

require('codepartner').setup({
  api_key = 'your_api_key_here',
  server_url = 'http://your_server_url:port'
  auto_start_server = true  -- Set to false if you want to start the server manually
})

Server Management

By default, the server will start automatically when you open Neovim. You can manage the server using the following commands:

To start the server manually:

:StartCodePartner()

To stop the server:

:StopCodePartner()

The server runs as a background process. You can find its logs in the plugin's server directory (codepartner_server.log).

About

neovim plugin to get AI-powered (llm) code explanation & assistance directly in the editor. fast and simple.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published