How do I delete a word and save it to a specific register?
Answer
"adiw
Explanation
The "adiw command deletes the inner word under the cursor and stores it in register a. The text is available for pasting with "ap.
How it works
"aspecifies registeradis the delete operatoriwis the inner word text object- The word is removed from the buffer and stored
Example
You want to move a variable name from one location to another:
"adiwon the word to cut it into registera- Navigate to the new location
"aPpastes it before the cursor
Tips
"aciwchanges the word and stores the old text ina"adddeletes the entire line to registera- Named registers preserve text across other operations
- Use different registers for different pieces of text