I've been following how to do search replace in vim, but somehow it doesnt work for my case. For example, I have the following code:
x(i,1,1) = y(i,1,1) + z(i,1,1)
Now, I want to change the last index, i.e change "x(i,1,1) to x(i,1,2)" and similar for y and z. I can just go change this manually but if I want to try our vim, just in case I have a larger expressions.
What I did: select the line visual mode (Shift + V)
. Then press :
, then vim has this in the status bar :'<,'>
, now I type: s/,1)/,2)
.
That only changes the first variable. In other words, I have this:
x(i,1,2) = y(i,1,1) + z(i,1,1)
Y and Z are not changed, even if they are on the same line and are selected together with X in visual mode.
Please help