I'd like to know if a file uses LF or CRLF line endings. I'm on Windows with vim installed. I don't want to convert the files, just know which line endings they use.
I know I can get the file format (dos
or unix
) used by running :set ff?
, but I can't find a way to have the result printed on standard output. :print
seems to only print a range of lines, and :echo
doesn't print anything on stdout.
I tried using scripted ex mode:
vim -e -s myfile < ../script.vim
with script.vim
containing:
echo ff?
1p
quit
The output contains the first line of myfile
, so the 1p
command is executed, but I can't see the result from echo ff?
. What's the right command to output something?