Skip to content

naps62/pair-gpt.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pair GPT - Neovim plugin

A GPT-assisted pair programming partner for Neovim.

Features

Write code from text prompts

asciicast

Refactor existing code

asciicast

Install

You need an account for OpenAI's API. Check out the pricing page to see how far you can go with the free plan (spoiler alert: should be more than enough to take this plugin out for a testdrive).

Export the API key as an environment variable. Add this to your .bashrc / .zshrc / etc:

export OPENAI_API_KEY=xxxxxxxxxxxxxxx

Install the binary:

cargo install --git https://github.com/naps62/pair-gpt.nvim

Install the plugin: with packer

" with vim-plug:
Plug 'naps62/pair-gpt.nvim'

" with packer:
use { 'naps62/pair-gpt.nvim',
  config = function()
    require('pair-gpt').setup()
  end
}

Setup should be included in a lua file or in a lua heredoc :help lua-heredoc if using in a vim file.

-- examples for your init.lua

-- empty setup using defaults
-- can be done directly via packer's config option, as seen above
require("pair-gpt").setup()

-- OR setup with some options
require("pair-gpt").setup({
  bin = "pair-gpt",
  model = "text-davinci-001"
})

Usage

Open a file with your editor. ensure filetype detection is live (this plugin uses that to pass down to the bot). The full list of commands is below. Note that all commands that work on a visual range also fallback to the current line the cursor is in.

Command type description
:PairGPTWrite range writes code based on a text prompt
:PairGPTRefactor range attempts to refactor the selected code (or current line)
:PairGPTExplain range writes a comment above the code with a natural-text explanation of what it does

About

an #openAI powered pair programming partner

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published