jessfraz / openai.vim

OpenAI GPT-3 plugin for vim.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

openai.vim

A vim plugin for auto-completing a line of text with OpenAI's GPT-3 API.

NOTE: This was more like a fun experiment if you are looking for fully functional AI-powered completion check out Codata's TabNine Vim Plugin.

Table of Contents

Installation

This plugin follows the standard runtime path structure. Below are some helper lines for popular package managers:

  • Vim 8 packages
    • git clone https://github.com/jessfraz/openai.vim.git ~/.vim/pack/plugins/start/openai.vim
  • Pathogen
    • git clone https://github.com/jessfraz/openai.vim.git ~/.vim/bundle/openai.vim
  • vim-plug
    • Plug 'jessfraz/openai.vim'
  • Vundle
    • Plugin 'jessfraz/openai.vim'

You must have curl and jq installed locally, as well as OPENAI_API_KEY set in your environment.

Usage

With your cursor on a line of text, or a selection of text in visual mode, :OpenAIComplete will send the line of text or selection to the OpenAI API and append the result in the lines following.

Or you can use whatever your <Leader> key is + o to complete the selection or line.

As seen in the gif below this is better for written words than code.

demo

About

OpenAI GPT-3 plugin for vim.


Languages

Language:Vim Script 100.0%