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

Re: Creating a new file saves with ^@

Expand Messages
  • Edward Marczak
    ... There s an easy way to find that out: start with no .vimrc. If the problem goes away, build it back up a piece at a time. -- Edward Marczak w:
    Message 1 of 5 , May 14, 2011
    • 0 Attachment
      On Fri, May 13, 2011 at 6:07 PM, Mellified Man <adrian@...> wrote:
      > I'm using MacVim 7.3 build 53 on OS X10.6.7. I create a new file using
      > CMD+o or CMD+t, enter some text, then save and close the file. When I
      > open the file again every character I entered is pre-pended with two
      > characters:
      > ^@
      >
      > If I cat the file I can grab the invalid input and paste the file
      > contents back in, save, and the file is fine after I reopen it.
      >
      > If I open a new file, save it, then enter new text and save it is file
      > upon reopening.
      >
      > I wouldn't be shocked to learn this is the result of something in
      > my .vimrc file but I have no idea where to look.

      There's an easy way to find that out: start with no .vimrc. If the
      problem goes away, build it back up a piece at a time.
      --
      Edward Marczak
      w: http://www.radiotope.com/writing
      Managed Prefs Book: http://goo.gl/8iVmo
      MacTech Conference: http://www.mactech.com/conference

      --
      You received this message from the "vim_mac" 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
    • Mellified Man
      ... I had set encoding=unicode in my .vimrc. Disabling this fixed the issue. Both fenc and fencs were unset. I don t recall why I thought I needed to change
      Message 2 of 5 , May 14, 2011
      • 0 Attachment
        On May 13, 5:38 pm, Ben Schmidt <mail_ben_schm...@...> wrote:
        > So I would investigate the 'fenc' and 'fencs' options, and perhaps even
        > 'enc'. If you mess with them in your .vimrc, you may well have made a
        > mistake. It sounds to me like 'fenc' is being given a default that
        > 'fencs' doesn't recognise upon reopening or something like that.
        >
        > Comparing the value of 'fenc' when the file is originally being created
        > and looks right with that when it is reloaded and looks wrong could
        > help, too. Use
        >
        > :verbose set fenc?

        I had "set encoding=unicode" in my .vimrc. Disabling this fixed the
        issue. Both fenc and fencs were unset. I don't recall why I thought I
        needed to change encoding in the first place.

        Thanks!

        --
        You received this message from the "vim_mac" 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
      • Tony Mechelynck
        ... Since Unicode is not an encoding known to Vim, it will translate to and from it using iconv, without realizing that Unicode often means UTF-16 or
        Message 3 of 5 , May 15, 2011
        • 0 Attachment
          On May 14, 10:01 pm, Mellified Man <adr...@...> wrote:
          > On May 13, 5:38 pm, Ben Schmidt <mail_ben_schm...@...> wrote:
          >
          > > So I would investigate the 'fenc' and 'fencs' options, and perhaps even
          > > 'enc'. If you mess with them in your .vimrc, you may well have made a
          > > mistake. It sounds to me like 'fenc' is being given a default that
          > > 'fencs' doesn't recognise upon reopening or something like that.
          >
          > > Comparing the value of 'fenc' when the file is originally being created
          > > and looks right with that when it is reloaded and looks wrong could
          > > help, too. Use
          >
          > > :verbose set fenc?
          >
          > I had "set encoding=unicode" in my .vimrc. Disabling this fixed the
          > issue. Both fenc and fencs were unset. I don't recall why I thought I
          > needed to change encoding in the first place.
          >
          > Thanks!

          Since "Unicode" is not an encoding known to Vim, it will translate to
          and from it using iconv, without realizing that "Unicode" often means
          "UTF-16" or "UTF-16le", which Vim knows and handles in a special way,
          because many characters, including all Latin-1 characters, have in
          these encodings a representation which includes a null byte (and null
          bytes have a special function in C strings). Therefore if you set
          'encoding' to UTF-16 (with or without le or be) Vim will use UTF-8
          internally, an encoding which can represent the same Unicode
          codepoints as any endianness variant of UTF-16 or UTF-32, but whose
          only use for a null byte is as the representation of the codepoint U
          +0000 <control> = NULL.

          See also http://vim.wikia.com/wiki/Working_with_Unicode

          --
          You received this message from the "vim_mac" 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
        Your message has been successfully submitted and would be delivered to recipients shortly.