0

I used to edit all my files with Vim and i never got problems with it. But, yesterday i take back some work from a developper and open the files he gaves me.

I don't really know why but Vim reads it as one line only :

<?php ^M $lesdatas=file_get_contents('datas.dat'); ^M $datas=explode('=>',$lesdatas); foreach ($datas as $data) { ^M // comment ^M $vals=explode('==',$data); 

Etc etc...

Looks like vim can't interpret ^ M as a 'Enter'.

How can i convert the file to read it normally ?

Thx for your help guys

1 Answer 1

1

Looks like the file is encoded in (traditional) Apple Mac format, using Carriage Return (CR, ^M) as the end-of-line delimiter (Windows uses CR-LF ^M^J, Unix LF ^J). Try opening the file with

:edit ++ff=mac filename 

If you need to open such files often, adapt your 'fileformats' setting, as described under :help fileformats.

Sign up to request clarification or add additional context in comments.

1 Comment

Is there a way to convert files definitly ?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.