Before googling, vim's help is usually the first place to go, and then the vim FAQ http://vimhelp.appspot.com/vim_faq.txt.html and the Vim tips wiki http://vim.wikia.com/wiki/Vim_Tips_Wiki.
In particular, you should read
:help file-formats
if you haven't already.
> ... You tend to lose track of the fact that
> you're writing text files or source code using filetype=unix.
I have an expression in my status line option
%1*%{&ff=~'u'?'':&ff}%*
which shows me the file format if it's not my usual unix, in a different colour to the rest of the status line (which I always have on with :set ls=2).
Regards, John Little
> Is it possible to make it a one liner?
Perhaps I should have given all the details, the way Tony M does.
My 'statusline' is set to
%<%f%1*%{&ff=~'u'?'':&ff}%* %h%m%r%=%-16.(%l,%2c %L%) %P
so I've got the usual stuff, with the dos or mac warning sitting right by the file name. My colour scheme has, amongst others,
hi Normal guifg=white guibg=black
hi StatusLine guifg=green guibg=DarkSlateGrey gui=underline,bold
hi StatusLineNC guifg=darkgreen gui=underline,italic
So the status line for the current window has a grey background, quite different from the black of the file I'm editing. The ff bit is coloured with highlight group User1, which I don't usually bother to define, so it comes out as Normal, white on black, not bold green underline on grey, quite distinct.
Now the bit in the %{ ... } is a vim expression, not a status line specifier, so status line specifiers won't work in it. However, if the %{ ... } has zero length, you don't see it, so just include both of them:
set statusline+=%{&ff=~'u'?'u':''}%1*%{&ff=~'u'?'':strpart(&ff,0,1)}%*
Regards, John