I see
alt text http://files.getdropbox.com/u/175564/fileformat-problem.png
where I have ^M
and ^[
at various places. The former seems to be enter, while the latter apparently the end/beginning of the line.
I would like to get the purple symbols out such that I can read the log -file better.
:set fileformats=unix,dos,mac
:e
but I get the same output.
How can you get the encoding/fileformat right?
^[
is another representation forEscape
(pressing Ctrl-[ is the same as pressing the escape key - the carat represents the control key). These are the beginning of ANSI color sequences. I don't think vim is going to show those colors (unless there's a filter that processes them).There is a plugin for
vim
called AnsiEsc that will display the results of ANSI color sequences in a file. In order to install that plugin, you'll need to install the Vimball plugin first. In order to take full advantage of AnsiEsc, you'll need to recompilevim
with the patch described on the AnsiEsc page.You have to set the fileformats before the file is loaded (or in your .vimrc file). It won't apply it to a file that's already loaded.
Alternative you can run s/\^M//g and s/\^[//g in vi to remove the offending characters but doesn't resolve the issue with the file handling. Do you know what encoding the file is using? You can guess by using
file
and it will give you info such as: "ASCII text, with CRLF line terminators
"NOTE: To enter the "^M" as "CTRL-V CTRL-M"
if it is an option you could try dos2unix (and its partner in crime unix2dos)