Technically, he %s/-/=/gdoes the job, but in the whole file, in each -.
If the lines you want to replace begin with -, I would do it like this:
g/^-/s/-/=/g
Or, if you have a space before the first -:
g/^\s*-/s/-/=/g
The remaining problem occurs in the following lines:
They turn into:
There are many ways to solve this. I am not the master to suggest a very general way, but it can work for a dash between words:
g/^-/s/\w\@<!-/g
source
share