-2

The basic format I need it in is this.

%s/search/replace/c

So I want it to search the entire file and ask for confirmation for every match found.

closed as off-topic by Rich, Martin Tournoij May 25 '17 at 11:52

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers." – Rich, Martin Tournoij
If this question can be reworded to fit the rules in the help center, please edit the question.

  • :%s/"/'/c? I am confused what your question is, as you already mentioned the :s command yourself? Are you having problems with it? If so, which? – Martin Tournoij May 24 '17 at 14:21
  • @Carpetsmoker I wondered the same thing myself, and took a guess that the missing g flag was the issue. – Rich May 24 '17 at 14:59
  • That seems likely @Rich. Would still be good if the OP would clarify the question to confirm (questions are supposed to be useful for others too, after all). – Martin Tournoij May 24 '17 at 15:31
  • I used the exact syntax you referenced CarpetSmoker. Maybe I had a typo or a weird issue with Bash on Windows? – JasparLamarCrab May 24 '17 at 23:13
1

Try:

:%s/"/'/gc

The g is important, because otherwise the command will only replace the first " on each line.

  • This worked. I thought I was typing exactly that; either I was searching the wrong file, or I need to slow down and pay attention to what I'm typing. I feel like a goofball right now, lol. – JasparLamarCrab May 24 '17 at 23:20
  • @JasparLamarCrab It happens to all of us! :) – Rich May 25 '17 at 8:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.