I opened vim without loading anything:
vim -V -u NONE
And typed one line:
<?xml?>
After running:
:unlet did_load_filetypes
:filetype on
I check the file type of current buffer:
:set ft?
It print filetype=
If I type
:unlet did_load_filetypes
:filetype detect
then :set ft? will print filetype=xml.
In the vim doc:
Detail: The ":filetype on" command will load one of these files:
Amiga $VIMRUNTIME/filetype.vim
Mac $VIMRUNTIME:filetype.vim
MS-DOS $VIMRUNTIME\filetype.vim
RiscOS Vim:Filetype
Unix $VIMRUNTIME/filetype.vim
VMS $VIMRUNTIME/filetype.vim
This file is a Vim script that defines autocommands for the
BufNewFile and BufRead events. If the file type is not found by the
name, the file $VIMRUNTIME/scripts.vim is used to detect it from the
contents of the file.
What’s differences between :filetype on and :filetype detect?
Thanks for your help.
From the manual: