How do I yank text inside delimiters into a specific named register?
Answer
"ayi(
Explanation
Combining named registers with text object motions lets you precisely yank structured content — like function arguments, quoted strings, or bracketed expressions — into specific registers for later use. This is essential for refactoring workflows.
How it works
"a— specify registerafor the next operationy— yank operatori(— inner parentheses text object (content inside())- The yanked text goes into register
a, not the default register
Example
" Yank function arguments into register a
"ayi(
" Yank string content into register s
"syi"
" Yank block content into register b
"byi{
Code: function(arg1, arg2, arg3)
Cursor inside parens, after "ayi(:
Register a: arg1, arg2, arg3
Tips
- Works with all text objects:
i",i',i[,i{,i<,it(tags) - Use
a(instead ofi(to include the delimiters themselves - Uppercase register appends:
"Ayi(adds to existing registeracontent - Combine with
"apto paste the specific register contents later