Is it possible to yank a function and paste it over a word such that it adopts that word as a parameter? For example if I have
def foo(name):
pass
"John"
Is there any way I can paste foo onto "John" so as to get foo("John")
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Certainly. You can use macros like these:
Lets unwrap them. The Yank macro assumes you have the function selected and performs the following actions:
<Esc>– cancel current selection`<– move to the start of last selection"ayf(– yank text up to and including the opening parenthesis into register “a”f)– move to the closing parenthesis"by'>– yank everything up to the end of last selection into register “b”The Paste macro is much simpler:
B– move to the beginning of the current word"aP– paste contents of register “a” in front of the current positionE– move to the end of the current word"bppaste contents of register “b” after the current position