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

Re: append to non-blank lines in a selection

Expand Messages
  • Paul Isambert
    ... Perhaps you should start with some basic stuff (like “*” or “$” or character classes) and then learn new things when you need them (that’s how I
    Message 1 of 7 , Jun 21, 2013
    • 0 Attachment
      Chris Lott <chris@...> a écrit:
      > On Fri, Jun 21, 2013 at 6:55 AM, Ben Fritz <fritzophrenic@...> wrote:
      > > Since you don't like regex (although you're right, you should learn)
      >
      > It's not that I don't like regex, it's that I've found them hard to
      > learn. Suggestions on good sites/books/etc to learn them would be much
      > appreciated.

      Perhaps you should start with some basic stuff (like “*” or “$” or
      character classes) and then learn new things when you need them
      (that’s how I got used to regex myself). For instance, Gary and Ben’s
      solution might give unwanted results if blank lines contain space
      characters. So your next step is “Could it be possible to match a line
      that contain at least one non-space character?” and a quick look up
      “:help pattern.txt” gives you “\S”:

      :g/\S/s/$/word/

      So my advice (I’m definitely no authority on that subject, mind you)
      is to *use* regex and fill in the blanks stepwise; if you really don’t
      know anything about regex (I doubt that is true, though), then perhaps
      “:help user_27” might be a good starting point.

      (And you definitely should use regex with Vim! Otherwise it’s like a
      corded drill with the power off.)

      Best,
      Paul

      --
      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Jean-Rene David
      ... Mastering Regular Expressions by Jeffrey Friedl is very good. It assumes no prior knowledge and will take you as far as you are willing to go. Very
      Message 2 of 7 , Jul 3, 2013
      • 0 Attachment
        * Chris Lott [2013.06.21 11:50]:
        > On Fri, Jun 21, 2013 at 6:55 AM, Ben Fritz <fritzophrenic@...> wrote:
        > > Since you don't like regex (although you're right, you should learn)
        >
        > It's not that I don't like regex, it's that I've found them hard to
        > learn. Suggestions on good sites/books/etc to learn them would be much
        > appreciated.

        "Mastering Regular Expressions" by Jeffrey Friedl
        is very good. It assumes no prior knowledge and
        will take you as far as you are willing to go.
        Very complete and well written.

        --
        JR

        --
        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      Your message has been successfully submitted and would be delivered to recipients shortly.