Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Use ChatGPT/OpenAI from inside Vim.
https://github.com/0xStabby/chatgpt-vim

chatgpt gpt gpt-3 gpt-4 openai plugin vim vim-plugin

Last synced: about 1 month ago
JSON representation

Use ChatGPT/OpenAI from inside Vim.

Awesome Lists containing this project

README

        

[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]





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][product-screenshot]](https://github.com/0xStabby/chatgpt-vim)
_generating a working todo web app with chatgpt-vim_

#### This plugin provides an easy way to use OpenAI's GPT API from within Vim.
#### It currently provides three commands and three mappings to make it easy to use.

(back to top)

### Built With

* [![Vim][Vim.org]][Vim-url]
* [![ChatGPT][OpenAI.com]][OpenAI-url]

(back to top)

## Getting Started

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

### Prerequisites

* [openai api key](https://beta.openai.com/account/api-keys)
* set openai key env variable, add this in your .bashrc
```sh
export OPENAI_API_KEY=sk-yourapikey
```

this plugin also relies on the following utils:
* bash
* curl
* [jq](https://github.com/jqlang/jq)

(back to top)

### Installation

1. Install with vim plugin manager of your choice

(back to top)

## Usage

[![GPTFile & GPTRun Demo][gpf-gpr-demo-gif]](https://github.com/0xStabby/chatgpt-vim)

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

### Commands

- `:Gpt` Prompts the user for a prompt and then uses OpenAI's GPT 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 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 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

- [x] Ask ChatGPT from Vim
- [x] Review output
- [x] Write output to file on user Confirmation
- [x] Hook up to openai api
- [ ] Add more functions
- [x] Send file contents along with request
- [x] 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](https://github.com/0xStabby/chatgpt-vim/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](https://twitter.com/0xStabby)

Project Link: [https://github.com/0xStabby/chatgpt-vim](https://github.com/0xStabby/chatgpt-vim)

(back to top)

[contributors-shield]: https://img.shields.io/github/contributors/0xStabby/chatgpt-vim.svg?style=for-the-badge
[contributors-url]: https://github.com/0xStabby/chatgpt-vim/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/0xStabby/chatgpt-vim.svg?style=for-the-badge
[forks-url]: https://github.com/0xStabby/chatgpt-vim/network/members
[stars-shield]: https://img.shields.io/github/stars/0xStabby/chatgpt-vim.svg?style=for-the-badge
[stars-url]: https://github.com/0xStabby/chatgpt-vim/stargazers
[issues-shield]: https://img.shields.io/github/issues/0xStabby/chatgpt-vim.svg?style=for-the-badge
[issues-url]: https://github.com/0xStabby/chatgpt-vim/issues
[license-shield]: https://img.shields.io/github/license/0xStabby/chatgpt-vim.svg?style=for-the-badge
[license-url]: https://github.com/0xStabby/chatgpt-vim/blob/master/LICENSE.txt
[product-screenshot]: images/chatgpt-vim.gif
[gpf-gpr-demo-gif]: images/gpf-gpr-demo.gif
[Vim.org]: https://img.shields.io/static/v1?style=for-the-badge&message=Vim&color=019733&logo=Vim&logoColor=FFFFFF&label=
[Vim-url]: https://vim.org
[OpenAI.com]: https://img.shields.io/badge/OpenAI-ChatGPT-159776?style=for-the-badge
[OpenAI-url]: https://chat.openai.com/