Using GPT-3 to generate Vim commands for editing text and cleaning GPT-3 prompts
Modifying text using natural language
To program GPT-3, you must give it a prompt. To do this, one of the things you need to do is clean your data into a prompt GPT-3 likes. Given a natural language prompt, this modifies the text accordingly, saving time. Here are some of the things it can do:
For “Insert "Q: " at the start of the line” it generates the Vi command “:%s/^/Q: /g”.
For “Remove whitespace from the start of each line” it generates the Vi command “:%s/^\s*/\1/g”.
For “Join each line with the next line” it generates the Vi command “:1,$j”.
For “Make all occurrences of Steve lowercase” it generates the Vi command “:%s/Steve/steve/g”.
In the future, this technology could be used for modifying code, such as within natural language IDEs.
The prompt I used is a Regular Expression cheatsheet and a basic Vim cheatsheet combined. However, GPT-3 can write commands that are not in these cheatsheets!
Try the demo here. It might save you some time when writing GPT-3 prompts. For security reasons, it requires a GPT-3 API key.