Vi-IMproved.org Wiki - File Format:

If you have extra leading or trailing characters (^M in unix or ^J in mac), use :%s/\r// to remove them. If you have long lines (mac line-ends with ff=dos or unix, unix line ends with ff=mac), use :%s/\r/\r/g to replace the wrong line-ends with the correct line-ends. If you are curious, the reasoning behind this methodology appears below.