feat: change to diff workflow
This commit is contained in:
25
README.md
25
README.md
@@ -1,5 +1,5 @@
|
||||
<!-- README.md -->
|
||||
# ChatGPT NeoVim Plugin (Extensively Updated with Step-by-Step Prompting)
|
||||
# ChatGPT NeoVim Plugin (Extensively Updated with Step-by-Step Prompting and Diff-Based Changes)
|
||||
|
||||
This plugin integrates a ChatGPT O1 model workflow into Neovim. It allows you to:
|
||||
|
||||
@@ -10,21 +10,26 @@ This plugin integrates a ChatGPT O1 model workflow into Neovim. It allows you to
|
||||
- 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.
|
||||
3. Receive **YAML changes from ChatGPT that include diffs**, then run `:ChatGPTPaste` to apply them or supply additional files.
|
||||
- If you’re updating an existing file, provide a `diff` field in the YAML.
|
||||
- If you’re creating a new file, use the `content` field.
|
||||
- If you’re deleting a file, use `delete: true`.
|
||||
|
||||
## New Key Features
|
||||
|
||||
- **Step-by-Step Prompting** (`enable_step_by_step: true`):
|
||||
If the request grows too large (exceeds `token_limit`), the plugin automatically generates a special prompt asking the model to split the task into smaller steps, working through them one by one. This approach helps you stay within the model’s maximum token limit without having to manually break things apart.
|
||||
If the request grows too large (exceeds `token_limit`), the plugin automatically generates a special prompt asking the model to split the task into smaller steps, working through them one by one.
|
||||
|
||||
- **Partial Acceptance**: If `partial_acceptance: true`, you can open a buffer that lists the final changes. Remove or comment out lines you don’t want, then only those changes are applied.
|
||||
- **Partial Acceptance**: If `partial_acceptance: true`, you can open a buffer that lists final diffs or file creations. You can remove or comment out lines you don’t want, then only those changes are applied.
|
||||
|
||||
- **Preview Changes**: If `preview_changes: true`, you get a buffer showing proposed changes before you apply them.
|
||||
- **Preview Changes**: If `preview_changes: true`, you get a buffer showing proposed diffs or new file content 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.
|
||||
|
||||
- **Diff-Based Changes**: Rather than supplying entire file content for edits, you can include a `diff` in the YAML response. This allows you to see exactly what changed line by line and accept or reject it.
|
||||
|
||||
## Example `.chatgpt_config.yaml`
|
||||
|
||||
```yaml
|
||||
@@ -49,18 +54,18 @@ token_limit: 3000
|
||||
|
||||
1. **`:ChatGPT`**
|
||||
- If `interactive_file_selection` is on, you’ll pick directories to include in a buffer named `ChatGPT_File_Selection`.
|
||||
- Save & close with `:wq`, `:x`, or `:bd` (you don’t have to use `:q`).
|
||||
- Save & close with `:wq`, `:x`, or `:bd`.
|
||||
- If `enable_step_by_step` is on and the prompt might exceed `token_limit`, the plugin will generate instructions prompting the model to address each step separately.
|
||||
|
||||
2. **Paste Prompt to ChatGPT**
|
||||
- If the task is split into steps, simply copy/paste them one by one into ChatGPT.
|
||||
|
||||
3. **`:ChatGPTPaste`**
|
||||
- The plugin reads the YAML from your clipboard. If it requests more files, it might again suggest a step-by-step approach.
|
||||
- The plugin reads the YAML from your clipboard. If it requests more files, it might again suggest a step-by-step approach.
|
||||
- If final changes are provided:
|
||||
- Optionally preview them (`preview_changes`).
|
||||
- Optionally partially accept them (`partial_acceptance`).
|
||||
- Then the plugin writes/deletes files as specified.
|
||||
- The plugin then applies file creation or deletion, or applies diffs to existing files.
|
||||
|
||||
## Troubleshooting & Tips
|
||||
- Adjust `token_limit` in `.chatgpt_config.yaml` as needed.
|
||||
@@ -80,6 +85,6 @@ commands:
|
||||
pattern: "searchString"
|
||||
target: "path/to/file/or/directory"
|
||||
```
|
||||
The **list** command now uses the Linux `ls` command to list directory contents. The **grep** command searches for a given pattern in a file or all files in a directory.
|
||||
The **list** command uses the system's `ls` command to list directory contents. The **grep** command searches for a given pattern in a file or all files in a directory.
|
||||
|
||||
Enjoy your improved, more flexible ChatGPT Neovim plugin with step-by-step support!
|
||||
Enjoy the improved, more flexible ChatGPT Neovim plugin with step-by-step and diff-based support!
|
||||
|
||||
Reference in New Issue
Block a user