I tried to replace '&=' with '=&' in Vim, but the command :%s/&=/=&/g
replaced '&=' with '=&='.
Why did that happen ? What command should I use ?
I tried to replace '&=' with '=&' in Vim, but the command :%s/&=/=&/g
replaced '&=' with '=&='.
Why did that happen ? What command should I use ?
Just escape the ampersand.
:%s/&=/=\&/g
You need to escape it because &
is a special character in the replacement that will be replaced with the entire matched pattern.