I'm looking for search and replace expressed on columns instead of rows.
Something like:

   :15,$s/foo/bar/gc

where 15 is the first column to consider and $ (in this case) is the
last column (whose value will change from row to row).


Well, you can do something like

        :%s/\%>15cfoo/bar/g

which, as you describe, works to the end of the line, or, if you want to specify a right-hand column, you can use

        :%s/\%>15cfoo\%<30c/bar/g

will substitute "foo" with "bar" only between columns 15 and 30 (adjust for the off-by-one that may or not may occur)

You can read more at

        :help /\%c

where you'll learn about the zero-width atom that allows you to specify the column information in a regexp.

Additionally, there's the "world-famous Dr. Chip's VisVim plugin" which allow you to select visual blocks and do substitution on them too. :)

-tim




Reply via email to