ChatGPT NeoVim Plugin (Updated for YAML and Default Prompt Blocks)
This plugin integrates a ChatGPT O1 model workflow into Neovim. It allows you to generate prompts containing:
- An initial prompt configured via a
.chatgpt_config.yamlfile in your project root. - A list of directories (also specified in the
.chatgpt_config.yaml) from which it gathers the complete project structure and file contents. - The content of the current file you are editing and the project's
README.md, if present. - Prompts are combined and copied to your clipboard, ready to be pasted into ChatGPT O1.
The ChatGPT O1 model is then expected to return modifications in a YAML format. You will then use the :ChatGPTPaste command to read these changes from the clipboard and apply them to your files.
Default Prompt Blocks
The configuration now supports specifying one or more "default prompt blocks." These blocks allow you to quickly switch between different kinds of specialized instructions for ChatGPT. For example:
- go-development: Focused on Go (Golang) coding best practices, idiomatic patterns, and Go-specific guidance.
- typo3-development: Focused on TYPO3 development practices, TypoScript, and extension coding guidelines.
- basic-prompt: A generic prompt that explains how to return modifications in the required YAML structure.
If you specify multiple blocks in default_prompt_blocks, their instructions are concatenated. This lets you combine multiple focus areas or start with a base prompt and add a specialized layer on top.
Example Configuration
Below is an example .chatgpt_config.yaml that sets a custom initial prompt, limits directories to scan, and selects default prompt blocks:
initial_prompt: "You are a coding assistant who will provide modifications in YAML form."
directories:
- "lua"
- "plugin"
default_prompt_blocks:
- "basic-prompt"
- "go-development"
With this configuration:
- The prompt shown to ChatGPT will include both the "basic-prompt" and "go-development" instructions, as well as the user’s message.
- Only the
luaandplugindirectories of your project will be included in the prompt.
Usage
- Run
:ChatGPTand enter your message. The combined prompt is copied to your clipboard. - Paste it into the ChatGPT O1 model.
- Copy the YAML response from ChatGPT into your clipboard.
- Run
:ChatGPTPasteto apply the changes to your files.
This workflow allows you to iterate quickly, making changes guided by AI while keeping a clear history and a structured approach.