Loading ...
Sorry, an error occurred while loading the content.

RE: column selection/column editing

Expand Messages
  • John Beckett
    ... Tip 438 is quite good, but I see what you mean: http://vim.wikia.com/wiki/Search_and_replace_in_a_visual_selection In the Substituting in a visual
    Message 1 of 9 , Oct 2, 2008
    • 0 Attachment
      reviol wrote:
      > Now I would like to replace each number in colum 7 by "3".
      >...
      > Note that I looked up Tip 438 in vim.wikia, which is related
      > to my problem, but unclear in the description of the steps.

      Tip 438 is quite good, but I see what you mean:
      http://vim.wikia.com/wiki/Search_and_replace_in_a_visual_selection

      In the "Substituting in a visual selection" section I made it a bit easy for myself
      by giving a single-line example. The :s/\%Vxx/yy/g command only operates on the
      current line. When working over several lines, you need to specify a range. Using
      :%s/\%Vxx/yy/g would work.

      In your case, you want to match any character, so 'xx' is '.', and you want to
      replace it with '7', so 'yy' is '7'. So, select the area with Ctrl-V (or perhaps
      Ctrl-Q), press Escape to remove the selection, then enter:

      :%s/\%V./7/g

      I know better solutions have been given for this particular example, but the above
      will handle a general substitute.

      Now someone has to edit the tip...

      John


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    Your message has been successfully submitted and would be delivered to recipients shortly.