Managing/Munging Line-Endings with Vi/Vim
If you have opened a file, and see a bunch "^M" or "^J" characters in it, chances are that for some reason Vim is confused as to the line-ending type.
You can force it to interpret the file with a specific line-ending by using the "++ff" argument and asking Vim to re-read the file using the ":e" command:
:e ++ff=unix :e ++ff=mac :e ++ff=dos
This will not actually change any characters in the file, just the way the file is interpreted.
If you want to resave the file with the new line-ending format, you can give the "++ff" argument to the ":w" command:
:w ++ff=unix :w ++ff=mac :w ++ff=dos
feed
Comments
0 comments postedPost new comment