Friday, March 22, 2013

Crazy vim one line expression to search for something and replace it with a different search relative to the first match

vim search to find idnum=XXX& and replace the XXX part with a search from the line before that line of i=999:


And it's much easier to explain that it was to figure out how to do it, or how it looks.

If anyone has an easier way, I'd love to hear it. I'm not very happy with the "getline" having to do the same search backwards, but I couldn't figure out the syntax for .-1 (by itself errored, ".-1", '.-1', "."-1 all failed).