Posts

Showing posts from November 25, 2012

vim problems with ^M (caret M), due to file format incompatibility

The problem with ^M or caret M that you see in files during editing or modifying is that incompatibility with vim 's default file format. Usually, if I have a file edited or created in Mac OS X, and when its edited via Linux, I got ^M plus the lines are displayed as one line which is freaking hard to edit. To fix this, just do edit the file, then reload the file in vim , :e ++ff=mac or :e ++ff=unix if it was created in Unix. This will render with a great view editor of your file from what you expected it should be. According to vim's Wiki, " unix LF only (each line ends with an LF character). dos CRLF (each line ends with two characters, CR then LF). mac CR only (each line ends with a CR character). CR is  carriage return  (return cursor to left margin), which is Ctrl-M or ^M or hex 0D "   You can read for more info for file format in this page  http://vim.wikia.com/wiki/File_format