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

69290Re: Line endings of messages to stderr in batch mode

Expand Messages
  • Bram Moolenaar
    Apr 28, 2013
      David B├╝rgin wrote:

      > When run in batch mode, Vim prints verbose :echo messages to stderr (see
      > ":h -s-ex").
      >
      > Unfortunately, by the look of it end-of-line characters aren't handled
      > correctly. On my unix machine I get CRLF line endings, and no line
      > endings on the last line.
      >
      > To reproduce, create a script "crlf.vim" with the following contents.
      >
      > function Echo()
      > echo "a"
      > echo "b"
      > echo "c"
      > endfunction
      > verbose call Echo()
      > quit
      >
      > Execute it in batch mode, redirecting stderr to a temporary file.
      >
      > vim -es <crlf.vim 2>tempfile
      >
      > These are the contents of the tempfile:
      >
      > 0000000: 610d 0a62 0d0a 63 a..b..c
      >
      > Whereas the output I would expect in a unix environment looks like this:
      >
      > 0000000: 610a 620a 630a a.b.c.

      In a terminal the CR characters are required. A NL (aka line feed) only
      moves the cursor to the next line, it doesn't go back to the first
      column.

      In the tty handling the CR is often automatically inserted, depending on
      the mode. Vim assumes raw mode, thus has to write the CR characters.

      --
      "Marriage is a wonderful institution...
      but who wants to live in an institution?"
      - Groucho Marx

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ an exciting new programming language -- http://www.Zimbu.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --
      --
      You received this message from the "vim_dev" 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_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 3 messages in this topic