Suppose a line of text reads:
$x = ( frobnicate( foo( bar( $x, $y )[ 1 ]))[ 1 ]);
The cursor is on the 'f' of 'frobnicate' and I want to yank the text which includes the call to frobnicate. (That is, everything up to the 3rd closing parenthesis. I can certainly do:
y3f)
or do it interactively with
vf);;y
but neither of these is appealing. (I don't want to have to count the '3' manually, nor do the repeated find until I hit the end point.) Is there an easy way to accomplish the move from 'f' to the matching closing paren? I'm thinking something like the v_i 'inner word' motion command.
To yank one line, position the cursor anywhere on the line and type yy . Now move the cursor to the line above where you want the yanked line to be put (copied), and type p . A copy of the yanked line will appear in a new line below the cursor.
You can copy a block of text by pressing Ctrl-v (or Ctrl-q if you use Ctrl-v for paste), then moving the cursor to select, and pressing y to yank. Now you can move elsewhere and press p to paste the text after the cursor (or P to paste before).
If your cursor is on the line with the function name, try d } . It will delete everything to the next block (i.e. your function body). Within the function body itself, d a p will delete the 'paragraph'. You can delete a curly brace block with d a } .
y%
seems to work.
From help %
:
Find the next item in this line after or under the cursor and jump to its match. inclusive motion. Items can be:
([{}])
parenthesis or (curly/square) brackets
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With