This is the mail archive of the
mailing list for the Cygwin project.
Re: end of file characters
On 2007-12-02, Peter Klavins wrote:
> > Another question... When I'm editing a file that has the ^Ms do I
> > leave them alone, or delete them? Will I be able to go back and forth
> > and
> > use vi via cygwin, and notepad/textpad via windows without harming the
> > file?
> In general, you don't really need to delete Ctrl-M's, so long as the
> files are working fine as they are. Vi happily reads and writes files
> with lines with or without Ctrl-M's. You'll find that Notepad is
> useless in editing files without Ctrl-M's, because it treats them as one
> long line. But WordPad works fine.
Except that WordPad always writes CR-LF at the ends of lines, even
if the original file had only LF line endings. That makes WordPad
useless for editing files that must have LF line endings such as
Editing files using vim has always worked for me. (In Cygwin, vi is
a link to vim.) It handles files with only LF line endings, only
CR-LF line endings and mixed LF and CR-LF line endings reasonably.
However, by default, vim writes a line-ending (either LF or CR-LF
depending on whether it thinks the file is a "unix" file or a "dos"
file) after the last line in a file, even if the original file had
none and the last was not modified by the user. Whether this is a
bug or a feature is debatable, but it's something to be aware of.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html