In Vim, I keep finding myself desiring a keystroke to rewrite the rest of some parameter list. For example, in the following Python function:
def myfun(a, b=12, c=(1,2,3), d=15):
pass
I wish to replace the c=(1,2,3), d=15
with e=12
. The keystroke ci(
allows me to replace everything inside the entire parameter list, but I find that I often want to retain some prefix of the Vim text-object. In general, I'd assume this keystroke I'm searching for would be useful in the context of replacing final parameters of function calls as well as definitions.
A desirable answer to this question would apply to quoted strings, []
blocks and other text objects too. Note that I understand all about text-objects as answered in "How to select between brackets (or quotes or ...) in Vim?".
Both @pb2q and @romainl give good search shortcuts, but they require me to visually find the end of the enclosing block to devise a search which is unambiguous in terms of any other garbage which is in the block (e.g. think nested function calls). In particular, I often find myself wanting this when I have nested parenthesis inside the parenthesis set I want to manipulate. The answer I really want is analogous to ci)
or ca)
which is entirely conceptually based on the nearest enclosing bracketing )
and deals entirely gracefully with other nested )
blocks.