[CentOS] Vim and text file line ending handling

Warren Young warren at etr-usa.com
Fri Jul 8 23:12:20 UTC 2011


On 7/8/2011 4:40 PM, Lars Hecking wrote:
>
>   I'd also love to teach vim how sto how those pesky ^M characters.

It does, when the line ending style is mixed.

When the line ending style is consistent, you can make Vim show the file 
type in the status line by adding something like this to your .vimrc:

set laststatus=2
set statusline=%F\ %m%r%h%w%y\ [%{&ff}]\ [%l,%v]\ [%p%% of %L lines]

The important bit is the %{&ff}: that will be "dos", "mac" or "unix". 
The brackets around it are decorations only.  Adjust to taste.



More information about the CentOS mailing list