我打開vim
無需加載任何東西:爲什麼'filetype on`在vim中沒有檢測到文件類型?
vim -V -u NONE
和類型一行:
:unlet did_load_filetypes
:filetype on
我檢查當前緩衝區的文件類型:
<?xml?>
運行後
:set ft?
它打印filetype=
如果鍵入
:unlet did_load_filetypes
:filetype detect
然後:set ft?
將打印filetype=xml
。
在VIM文檔:
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.
什麼:filetype on
和:filetype detect
之間的區別是什麼?
感謝您的幫助。