Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
docs:vim:fileformats [2008/08/03 00:25] – external edit 127.0.0.1docs:vim:fileformats [2009/06/24 17:39] (current) billh
Line 6: Line 6:
 <code> <code>
 :e ++ff=mac :e ++ff=mac
 +</code>
 +
 +If your file **does not** have consistent line endings throughout, you need to force vim to load it a certain way without any assumptions.  This example is where the output from a grep command was run and captured to a file.  Some of the results were from dos files, and others from unix files, so the line endings aren't consistent, and vim shows us ^M characters because it is interpreted as unix.
 +<code>
 +:set ffs=dos
 +:e ++ff=dos
 +</code>
 +In this case you should see vim list [CR missing] in the status line after loading the file.  Vim has fixed the line endings for you, so now you can simply do this to save the file and open it as a corrected dos file:
 +<code>
 +:w
 +:e!
 </code> </code>
  
  • docs/vim/fileformats.1217744747.txt.gz
  • Last modified: 2009/06/24 17:39
  • (external edit)