[Gllug] vi question

Bruce Richardson itsbruce at uklinux.net
Thu Aug 29 19:39:51 UTC 2002


On Thu, Aug 29, 2002 at 08:16:12PM +0100, Pavel wrote:
> Hello list, 
> 
> I tend to use mainly vi for editing text, altough I am just about touching 
> its surface in terms of being able to use it well.
> While editing a html file, I've noticed that at the end of each line appears 
> a "^M" (without the inverted commas). I've inserted a very long line without 
> the "^M" at the end of the line and it made no difference. My browser still 
> displayed the page as normal,  wrapping the text as imposed by the its 
> window size.
> 
> Does anyone know what is the role of this "^M" if any ?

It's a Carriage Return.  Back in the day, some systems marked
line-endings in text files with a Line Feed character, others with
Carriage Return (both taking their name from the days when teletype
output was common).  *nix systems use Line Feed but for no very good
reason, DOS format text files use both together.

You can convert DOS text files to Unix format using the dos2unix
utility.  If you are using Vim then you can do

:set ff=unix

and then save the file.

-- 
Bruce

Remember you're a Womble.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 261 bytes
Desc: not available
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20020829/249ea516/attachment.pgp>


More information about the GLLUG mailing list