How vim detects file types
April 15, 2014 12:03:45 Last update: April 15, 2014 12:03:45
To show the file type identified by vim for the file you are currently editing, type "
:set filetype
" in vim command. From vim Help, this is how vim identifies file type:
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.