Rather than choosing one character to be displayed as the EOL character, I'd like one to display for both CR and LF separately and regardless of if the file is unix or dos. Is this possible?
With some caveats, you can do this using Vim's binary mode. It seems you might want to use the command
vim -b +'set list' somefile
Alternatively, you can put the following in your
:set binary :set list
The important thing is that binary mode must get set before the file in question is read into a buffer. Once Vim has read the file in, it's too late; this trick relies on changing how Vim reads the file in. Specifically, what you need is for Vim to not attempt to guess the file's particular type of
Binary mode does what you want, disabling this automatic line-separator detection, but it does quite a few other things as well:
So you might not want to have this in your
.vimrc; it might be better to use the command-line version, and only for those files where you need this special kind of display.
For more information:
If you add to your
set ffs=unix set list
That will always show
By default, vim would interpret a file that only has
CRLF endings as a dos file and show
$. By setting
ffs=unix, you force vim to always open as a unix file, and therefore the CR is treated as an extra character.
Note: Be careful if modifying and saving dos files though. If you press
ENTER, it will only insert a
LF. You would need to manually insert a
CR by typing