Benoit and Epeli have some good points, but it’s very difficult for me to write .,/^}/ Before my wildcard expression, and since it only changes the code from the cursor position to the next line, starting with } , it depends on the presence of the cursor position at the beginning function or block (and it will not work for an entire function with an if statement).
So instead, I use visual mode in combination with text objects. For example, by typing vi{ , we’ll select the entire code within the next pair of matches {} , va{ will contain the characters {} , and if you do this using the visual line ( vi{V ), you will also receive a full function declaration. Then you can simply do :s/\<arg1\>/new_name/g to rename arg1 to new_name , including function parameters.
source share