Submit prompt in ChatGPT when pressing Enter or Ctrl + Enter, including for edited prompts
当前为
This script automatically submits the prompt in ChatGPT when you press the **Enter** key or the **Ctrl + Enter** key combination. It works both for new prompts and for editing previously entered prompts.
It works on the following pages:
- https://chatgpt.com/
- https://chatgpt.com/c/*
This is particularly useful for users who prefer using keyboard shortcuts to interact with ChatGPT, including when editing old prompts.
## Features:
- **Enter**: Submits the prompt.
- **Ctrl + Enter**: Also submits the prompt.
- **Prevents default behavior**: The script prevents a new line from being added when you press **Enter** or **Ctrl + Enter**.
- Works for both **new** prompts and **edited** prompts.
## Instructions:
1. Install [Tampermonkey](https://tampermonkey.net/) extension if you don't have it already.
2. Create a new Tampermonkey script.
3. Paste the code above into the script editor.
4. Save the script.
5. Visit ChatGPT at **https://chatgpt.com/** or any **https://chatgpt.com/c/** page.
6. Now, pressing **Enter** or **Ctrl + Enter** will automatically submit your prompt, including edited ones.
## Notes:
- This script assumes that the ChatGPT input field is a `textarea` and that editable message text areas have the same or similar structure. If the page structure changes in future updates, you may need to adjust the script.
- The script currently only works for the mentioned URLs (`https://chatgpt.com/` and `https://chatgpt.com/c/*`). If you want to extend it to other pages, modify the `@match` directive in the script.
*/