2

I have one line of code that I need to replace in Vim. I need to replace one line of code errors += 1; to errors++; just to simplify it.

When I do :%s/errors += 1;/errors++;/a I get E488:Trailing Characters.

Does anyone know how to do this?

Rook
  • 60,248
  • 49
  • 165
  • 242
homersimpson
  • 4,124
  • 4
  • 29
  • 39

1 Answers1

6

You have /a at the end as a flag: a isn't a substitute flag. Without the a this should work for you.

Use c if you want to manually confirm each replacement.

Use g if you want to replace all occurrences on a line.

pb2q
  • 58,613
  • 19
  • 146
  • 147
  • Thank you!! For some reason I had thought the /a meant "all" but the normal search/replace function without the flag did work perfectly! Thanks! – homersimpson Oct 03 '12 at 03:44