chatgpt.nvim is a Neovim plugin that lets you query ChatGPT inside a Neovim buffer.
n.b. You must have python3 installed on your machine in order to install and use this plugin.
You can install this plugin with packer or any other vim plugin manager:
use({
'terror/chatgpt.nvim',
run = 'pip3 install -r requirements.txt'
})
The plugin looks for a configuration file in your home directory called
.chatgpt-nvim.json
, and it expects a valid session_token
to be set for
queries to work:
{
"authorization": "<API-KEY>", # Optional API key
"session_token": "<SESSION-TOKEN>" # Your ChatGPT session token
}
You can find your session token by completing the following steps:
- Navigate to https://chat.openai.com/chat after logging in or signing up
- Open the developer console (F12)
- Application > Cookies
- Copy the value under
__Secure-next-auth.session-token
into thesession_token
field present in the.chatgpt-nvim.json
configuration file
Below are the available commands this plugin supports:
Name | Arguments | Description |
---|---|---|
ChatGPT | Open a new interactive ChatGPT environment | |
ChatGPT | [query] | Load a ChatGPT response to query into the Neovim command prompt. |
The underlying API wrapper this plugin uses (for now) is revChatGPT
, which is
open source and can be found here:
https://github.com/acheong08/ChatGPT.