Quantcast
Channel: Greg – code.commongroove.com
Viewing all articles
Browse latest Browse all 30

DOS to Linux line endings in VIM

$
0
0

Switching between Windows and Linux machines every day, you’ll undoubtedly end up with files in the Linux system with DOS line endings. You can easily change the line endings in the editor VIM using the following commands:

:w ++ff=dos
:w ++ff=mac
:w ++ff=unix

You can also change the file from the command line directly without “opening” VI, e.g.

vi +':wq ++ff=unix' ./some_file.txt

There is also a small common utility to help with line endings called dos2unix. It allows you to easily convert files from the command line.

Hope this helps!


Viewing all articles
Browse latest Browse all 30

Trending Articles