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

Vim Regexes and Mac Newlines

Expand Messages
  • jeffthewookiee
    I m currently working with vi on OS X machines. I d like to be able to use its regex support to quickly add newlines and format things nicely. However ... I
    Message 1 of 3 , Dec 13, 2006
    • 0 Attachment
      I'm currently working with vi on OS X machines. I'd like to be able to use
      its regex support to quickly add newlines and format things nicely. However
      when I run something like this command:

      :%s/,/,\n/

      I end up with output like this:

      CourtDismissedCount3,^@

      Instead of nice newlines, I get ^@'s instead. Is there any way to fix this?
      --
      View this message in context: http://www.nabble.com/Vim-Regexes-and-Mac-Newlines-tf2816824.html#a7861848
      Sent from the Vim - Mac mailing list archive at Nabble.com.
    • Bernhard Prümmer
      ... What I do, and what has always worked for me is ... where ^V and ^M mean Ctrl-V and Ctrl-M. See ... on this. Cheers Bernhard
      Message 2 of 3 , Dec 13, 2006
      • 0 Attachment
        Am 13.12.2006 um 22:36 schrieb jeffthewookiee:

        >
        > I'm currently working with vi on OS X machines. I'd like to be able
        > to use
        > its regex support to quickly add newlines and format things nicely.
        > However
        > when I run something like this command:
        >
        > :%s/,/,\n/
        >
        > I end up with output like this:
        >
        > CourtDismissedCount3,^@
        >
        > Instead of nice newlines, I get ^@'s instead. Is there any way to
        > fix this?
        > --
        > View this message in context: http://www.nabble.com/Vim-Regexes-and-
        > Mac-Newlines-tf2816824.html#a7861848
        > Sent from the Vim - Mac mailing list archive at Nabble.com.
        >

        What I do, and what has always worked for me is

        :%s/,/,^V^M/

        where ^V and ^M mean Ctrl-V and Ctrl-M.
        See
        :help i_CTRL-V
        on this.

        Cheers
        Bernhard
      Your message has been successfully submitted and would be delivered to recipients shortly.