delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/12/03/12:01:51

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Mon, 3 Dec 2007 09:01:17 -0800
From: Gary Johnson <garyjohn AT spk DOT agilent DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: end of file characters
Message-ID: <20071203170117.GA27870@suncomp1.spk.agilent.com>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <729528 DOT 66694 DOT qm AT web36807 DOT mail DOT mud DOT yahoo DOT com> <006f01c8350f$fbc40bd0$f34c2370$@net.au>
MIME-Version: 1.0
In-Reply-To: <006f01c8350f$fbc40bd0$f34c2370$@net.au>
User-Agent: Mutt/1.5.17 (2007-11-01)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

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.

Regards,
Gary


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019