Note that cf) will change everything up to and including the closing paren.
ct) (change to) will change everything from the cursor up to, but not including the paren.
But if you're trying to change everything in parens, you can simply use: ci(, regardless of where your cursor is as long as it's somewhere in a matched set. ci{, ci[, etc... also work. I find it pretty useful when working with code that uses a lot of those.
I have 2 use cases for cf), but I don't use it a lot in the end:
One is when inside a parenthesis, and wanting to really delete till the closing parenthesis. But that would leave an unbalanced open paren. So in this case, I use ct) most of the times.
The other is when the cursor is before the opening parenthesis, and I want to delete the whole block. In that case, I found c% to be easier to me. The advantage being that it works with other delimiters ({[]}) handles nesting better, and it's multiline friendly.
If instead of c%, we speak about d%, another plus is that dot (.) will repeat the generic command, so
if (is_foo()) {
return 1;
}
can be cleared with `d%.` from the beginning of the first line.
Yep, good point. They are useful when you want to change the whole text inside the delimiters (and IME, it's most of the times), but they do different things than cf( because they also change/delete text behind the cursor.
`c])` is also pretty handy when you're within a bunch of parentheses. For instance,
if funca(funcb(red, green), funcc(blue, yellow)) {
^
If you are where the arrow is, `c])` will change the second argument. If you were on the comma before it, `d])` will remove all but the first argument.
ct) (change to) will change everything from the cursor up to, but not including the paren.
But if you're trying to change everything in parens, you can simply use: ci(, regardless of where your cursor is as long as it's somewhere in a matched set. ci{, ci[, etc... also work. I find it pretty useful when working with code that uses a lot of those.