vim : remove ^M

1

vim下 :%s/^M//g 或者 :1,$s/^M//g 均可
补充一点:
^M是使用 "CTRL-V CTRL-M" 而不是字面上的 ^M

2

:set ff=unix

3

dos2unix || unix2dos