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

Re: Line break without \n or \r?

Expand Messages
  • Bee
    ... Finds a linefeed followed by a non-linefeed and replaces the linefeed with a space. Changes this: ============= uuuu An by y uuuu An by y To this: ========
    Message 1 of 5 , Apr 6, 2013
    • 0 Attachment
      On Apr 6, 2:10 pm, zappathus...@... wrote:
      > Now I understand, and it's actually quite simple.
      > The pattern
      >     \([^\\n]\)\n\([^\\n]\)
      > ...
      > and you ended up with
      >     uuuu An
      >     by y
      > because the "n" at the end of the first line was excluded
      > from the pattern.

      Can be simplified to:

      :%s/\n\([^\n]\)/ \1/

      Finds a linefeed followed by a non-linefeed
      and replaces the linefeed with a space.

      Changes this:
      =============

      uuuu
      An
      by
      y

      uuuu
      An
      by
      y

      To this:
      ========

      uuuu An by y
      uuuu An by y

      Then if needed, a second search/replace to
      separate 'paragraphs' by at most one blank line:

      :%s/\n\+/\r\r/

      To this:
      ========

      uuuu An by y

      uuuu An by y

      Bill

      --
      --
      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.