0

When I save a simple spreadsheet in Excel 15.41 (on Mac) as tab-delimited .txt and open it using vim <filename>, I see characters for carriage returns as ^M, but everything is on one line. There is one $ character shown at the end of the single line when I use :set list:

1^I2^I3^I4^M1^I2^I3^I4^M1^I2^I3^I4$     

Because fileformat=unix for this file, I expected to see no carriage return characters. Does anyone know why I'm seeing the opposite? I am also unsure of why all lines are read as one following this procedure.

When I save the same spreadsheet as UTF-16 unicode .txt and open it using vim, fileformat=dos. :set list properly shows line ending characters, but there are no carriage return characters. My understanding was that DOS files should also contain a carriage return at line endings.

1^I2^I3^I4$     
1^I2^I3^I4$     
1^I2^I3^I4$ 

There is a lot of information out there about line endings, but I could not find a direct answer to explain these observations. Any help or direction to clarifying resources would be much appreciated.

Jeff

0

In the first case, Vim apparently doesn't properly detect the line endings. The sole use of CR (^M) is the (old) Mac-style. You can add mac to the 'fileformats' option, or explicitly specify the format when opening:

:edit ++ff=mac FILE.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.