News for hackers. Stuff that matters.
Re:Ten Years of Vim by JepZ on Monday May 21, 2018 @05:48AM (#17117212)
Regarding the replace thing:

If you are used to sed it should be easy, as it is pretty much the same. I keep using this pattern over and over again:

  :%s/search/replace/gc
The '%' is some sort of reference to the file you are currently editing and therefore you are doing a replace on the whole file. You can see the difference in combination with some visual selection. When you select some text and press ':' it opens as ":'<,'>"

  :%        # replace in the whole file
  :'<,'>    # replace in the current selection
The 'gc' flags at the end are:

  g=global to replace multiple times per line
  c=confirm to let vim ask you about every replacement
Sometimes its just easier to let vim ask you a few times than to spend 5 minutes to figure out the 100% correct regex.
Re:Ten Years of Vim by bArray on Tuesday May 22, 2018 @12:44AM (#17123778)
Thank you for explaining this! I will have to practice, replace is something I don't do very often enough to remember but do it often enough that it annoys me each time.