Gp.nvim (GPT prompt) Neovim AI plugin

gp.nvim: ChatGPT like sessions, Instructable text/code operations, Speech to text and Image generation in your favorite editor.

Youtube demos

Goals and Features

The goal is to extend Neovim with the power of GPT models in a simple unobtrusive extensible way.
Trying to keep things as native as possible – reusing and integrating well with the natural features of (Neo)vim.

  • Streaming responses
    • no spinner wheel and waiting for the full answer
    • response generation can be canceled half way through
    • properly working undo (response can be undone with a single u)
  • Infinitely extensible via hook functions specified as part of the config
  • Minimum dependencies (neovimcurlgrep and optionally sox)
    • zero dependencies on other lua plugins to minimize chance of breakage
  • ChatGPT like sessions
    • just good old neovim buffers formated as markdown with autosave and few buffer bound shortcuts
    • last chat also quickly accessible via toggable popup window
    • chat finder – management popup for searching, previewing, deleting and opening chat sessions
  • Instructable text/code operations
    • templating mechanism to combine user instructions, selections etc into the gpt query
    • multimodal – same command works for normal/insert mode, with selection or a range
    • many possible output targets – rewrite, prepend, append, new buffer, popup
    • non interactive command mode available for common repetitive tasks implementable as simple hooks
      (explain something in a popup window, write unit tests for selected code into a new buffer,
      finish selected code based on comments in it, etc.)
    • custom instructions per repository with .gp.md file
      (instruct gpt to generate code using certain libs, packages, conventions and so on)
  • Speech to text support
    • a mouth is 2-4x faster than fingers when it comes to outputting words – use it where it makes sense
      (dicating comments and notes, asking gpt questions, giving instructions for code operations, ..)
  • Image generation
    • be even less tempted to open the browser with the ability to generate images directly from Neovim
-- lazy.nvim
{
	"robitx/gp.nvim",
	config = function()
		require("gp").setup()

		-- or setup with your own config (see Install > Configuration in Readme)
		-- require("gp").setup(config)

        	-- shortcuts might be setup here (see Usage > Shortcuts in Readme)
	end,
}