blob: a8f2f72820907a8dd73c9b464a69531bbb6dd22b [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim support file to detect file types in scripts
2"
Christian Brabandte978b452023-08-13 10:33:05 +02003" Maintainer: The Vim Project <https://github.com/vim/vim>
dkearns73aba182023-08-28 03:47:29 +10004" Last Change: 2023 Aug 27
Christian Brabandte978b452023-08-13 10:33:05 +02005" Former Maintainer: Bram Moolenaar <Bram@vim.org>
Bram Moolenaar071d4272004-06-13 20:20:40 +00006
7" This file is called by an autocommand for every file that has just been
8" loaded into a buffer. It checks if the type of file can be recognized by
9" the file contents. The autocommand is in $VIMRUNTIME/filetype.vim.
10
11
Bram Moolenaar299d8e52022-02-13 20:32:02 +000012" Bail out when a FileType autocommand has already set the filetype.
Bram Moolenaar071d4272004-06-13 20:20:40 +000013if did_filetype()
14 finish
15endif
16
17" Load the user defined scripts file first
18" Only do this when the FileType autocommand has not been triggered yet
Bram Moolenaarf4630b62005-05-20 21:31:17 +000019if exists("myscriptsfile") && filereadable(expand(myscriptsfile))
Bram Moolenaar071d4272004-06-13 20:20:40 +000020 execute "source " . myscriptsfile
21 if did_filetype()
22 finish
23 endif
24endif
25
Bram Moolenaar299d8e52022-02-13 20:32:02 +000026" The main code is in a compiled function for speed.
27call dist#script#DetectFiletype()