Files
chatgpt.vim/README.md

67 lines
3.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- README.md -->
# ChatGPT NeoVim Plugin (Extensively Updated with Chunking)
This plugin integrates a ChatGPT O1 model workflow into Neovim. It allows you to:
1. Generate prompts containing:
- An **initial prompt** (from `.chatgpt_config.yaml`)
- A list of directories (also specified in `.chatgpt_config.yaml`) from which it gathers the project structure and file contents
- **Interactive file selection** if enabled, so you can pick exactly which directories to include
- Any **initial files** you define (e.g., `README.md`, etc.)
2. Copy these prompts to your clipboard to paste into ChatGPT O1.
3. Receive YAML changes from ChatGPT, then run `:ChatGPTPaste` to apply them or supply additional files.
## New Key Features
- **Chunking** (`enable_chunking: true`): If the combined prompt or file request is too large (exceeds `token_limit`), the plugin automatically splits it into multiple chunks. Each chunk is opened in its own buffer, and the first chunk is copied to your clipboard. You can paste them sequentially into ChatGPT to work around size limitations.
- **Partial Acceptance**: If `partial_acceptance: true`, you can open a buffer that lists the final changes. Remove or comment out lines you dont want, then only those changes are applied.
- **Preview Changes**: If `preview_changes: true`, you get a buffer showing proposed changes before you apply them.
- **Interactive File Selection**: If `interactive_file_selection: true`, you choose which directories from `.chatgpt_config.yaml` get included in the prompt, reducing token usage.
- **Improved Debug**: If `improved_debug: true`, debug logs go into a dedicated `ChatGPT_Debug_Log` buffer for easier reading.
## Example `.chatgpt_config.yaml`
```yaml
project_name: "chatgpt_nvim"
default_prompt_blocks:
- "basic-prompt"
- "workflow-prompt"
directories:
- "."
initial_files:
- "README.md"
debug: false
enable_chunking: true
preview_changes: true
interactive_file_selection: true
partial_acceptance: true
improved_debug: true
token_limit: 3000
```
## Usage
1. **`:ChatGPT`**
- If `interactive_file_selection` is on, youll pick directories to include in a buffer named `ChatGPT_File_Selection`.
- Save & close with `:wq`, `:x`, or `:bd` (you dont have to use `:q`).
- If `enable_chunking` is on and the prompt exceeds `token_limit`, its split into multiple buffers for you to copy/paste.
2. **Paste Prompt to ChatGPT**
- If multiple chunks exist, copy/paste them one by one in ChatGPT.
3. **`:ChatGPTPaste`**
- The plugin reads the YAML from your clipboard. If it requests more files, it might chunk that request, too.
- If final changes are provided:
- Optionally preview them (`preview_changes`).
- Optionally partially accept them (`partial_acceptance`).
- Then the plugin writes/deletes files as specified.
## Troubleshooting & Tips
- Adjust `token_limit` in `.chatgpt_config.yaml` as needed.
- If partial acceptance is confusing, remember to remove or prepend `#` to lines you dont want before saving and closing the buffer.
- If chunking occurs, ensure you copy/paste **all chunks** into ChatGPT in the correct order.
- Check `ChatGPT_Debug_Log` if `improved_debug` is on, or the Neovim messages if `debug` is on, for detailed info.
- You can close the selection or prompt buffers at any time with commands like `:bd`, `:x`, or `:wq`. No need to rely on `:q`.
Enjoy your improved, more flexible ChatGPT Neovim plugin with chunking support!