Skip to content

k-amemiya/chatgpt-vim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License


Logo

chatgpt-vim

ChatGPT/OpenAI in Vim
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact

About The Project

Product Name Screen Shot generating a working todo web app with chatgpt-vim

This plugin provides an easy way to use OpenAI's GPT-3 API from within Vim.

It currently provides three commands and three mappings to make it easy to use.

(back to top)

Built With

  • Vim
  • ChatGPT

(back to top)

Getting Started

To get a local copy up and running follow these simple example steps.

Prerequisites

This plugin works with both chatgpt wrapper/cli or the openai-cli

  • The openai-cli option works with the openai api and an api key.
  • The chatgpt wrapper/cli option works with chatgpt by connecting through the browser ui to get the session key.

With chatgpt somethimes being too busy to use the openai-cli option is more reliable.

With the openai-cli option there is also the ability to change the model you would like to interact with.

Currently the GptRun and GptFile commands are only available for the openai api option. the :Gpt command is available on either option. I may add :GptRun and :GptFile to the ChatGPT option in the future, but for now they are available with the api openai api option since it's the more reliable option.

For the openai-cli option you will need (Recommended):

  • openai api key
  • openai-cli
    pip install openai-cli
  • create a ~/.config/openai.token file and add your openai api key to it
    echo "YOUR TOKEN HERE" > ~/.config/openai.token
For the chatgpt wrapper/cli option you will need (Incomplete / Not Recommended):
  • chatgpt-wrapper
    pip install git+https://github.com/mmabrouk/chatgpt-wrapper
    playwright install firefox
    
  • You will need to login to chatgpt at first
    chatgpt install
    
  • Exit out of that command once you are logged in

(back to top)

Installation

  1. Install with vim plugin manager of your choice

(back to top)

Usage

GPTFile & GPTRun Demo

If there is a ~/.config/openai.token the openai api will be used by default.

Commands

:Gpt is available to either option chatgpt or openai. :GptRun and :GptFile are only available with the openai option.

  • :Gpt Prompts the user for a prompt and then uses OpenAI's GPT-3 API or ChatGPT to generate a response.
  • :GptRun Prompts the user for a command to run on the current file and then uses OpenAI's GPT-3 API to generate a response based on the contents of the current file and run log.
  • :GptFile Prompts the user for a prompt and then uses OpenAI's GPT-3 API to generate a response based on the contents of the current file.

Mappings

  • gpt Maps to the :Gpt command.
  • gpr Maps to the :GptRun command.
  • gpf Maps to the :GptFile command.

(back to top)

Roadmap

  • Ask ChatGPT from Vim
  • Review output
  • Write output to file on user Confirmation
  • Hook up to openai api
  • Add more functions
    • Send file contents along with request
    • Send file contents and run log along with request
    • Send visually selected contents along withrequest and replace selected
    • More useful stuff as I think of it

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Twitter: @0xStabby

Project Link: https://github.com/0xStabby/chatgpt-vim

(back to top)

About

Use ChatGPT/OpenAI from inside Vim.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vim Script 100.0%