vim Converting text files from DOS to UNIX with vi

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Remarks

The ^M character stands for a carriage return in Vim (<c-m> or just <CR>). Vim displays this character when at least on line in the file uses LF line endings. In other words, when Vim consider a file to have fileformat=unix but some lines do have carriage returns (CR), the carriage returns are displayed as ^M.

A file that has a single line with LF line ending and several lines with CRLF line endings is most often created by wrongly editing a file created on a MSDOS based system. For example, by creating a file under an MSDOS operating system, copying it to a UNIX based system, and then prepending a hash-bang sting (e.g. #!/bin/sh) using tools on the UNIX based operating system.



Got any vim Question?