filetype.vim (55209B)
1 " Vim support file to detect file types 2 " 3 " Maintainer: The Vim Project <https://github.com/vim/vim> 4 " Last Change: 2026 Sep 24 5 " Former Maintainer: Bram Moolenaar <Bram@vim.org> 6 7 " If the filetype can be detected from extension or file name(the final path component), 8 " please update `ft_from_name` and `ft_from_ext` in `runtime/autoload/dist/ft.vim`. 9 " Otherwise add a new autocmd in this file. 10 11 " Listen very carefully, I will say this only once 12 if exists("did_load_filetypes") 13 finish 14 endif 15 let did_load_filetypes = 1 16 17 " Line continuation is used here, remove 'C' from 'cpoptions' 18 let s:cpo_save = &cpo 19 set cpo&vim 20 21 augroup filetypedetect 22 23 " Ignored extensions 24 if exists("*fnameescape") 25 au BufNewFile,BufRead ?\+.orig,?\+.bak,?\+.old,?\+.new,?\+.dpkg-dist,?\+.dpkg-old,?\+.dpkg-new,?\+.dpkg-bak,?\+.rpmsave,?\+.rpmnew,?\+.pacsave,?\+.pacnew 26 \ exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r")) 27 au BufNewFile,BufRead *~ 28 \ let s:name = expand("<afile>") | 29 \ let s:short = substitute(s:name, '\~\+$', '', '') | 30 \ if s:name != s:short && s:short != "" | 31 \ exe "doau filetypedetect BufRead " . fnameescape(s:short) | 32 \ endif | 33 \ unlet! s:name s:short 34 au BufNewFile,BufRead ?\+.in 35 \ if expand("<afile>:t") != "configure.in" | 36 \ exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r")) | 37 \ endif 38 elseif &verbose > 0 39 echomsg "Warning: some filetypes will not be recognized because this version of Vim does not have fnameescape()" 40 endif 41 42 " Pattern used to match file names which should not be inspected. 43 " Currently finds compressed files. 44 if !exists("g:ft_ignore_pat") 45 let g:ft_ignore_pat = '\.\(Z\|gz\|bz2\|zip\|tgz\)$' 46 endif 47 48 " Function used for patterns that end in a star: don't set the filetype if the 49 " file name matches ft_ignore_pat. 50 " When using this, the entry should probably be further down below with the 51 " other StarSetf() calls. 52 func s:StarSetf(ft) 53 if expand("<amatch>") !~ g:ft_ignore_pat 54 exe 'setf ' . a:ft 55 endif 56 endfunc 57 58 " Vim help file, set ft explicitly, because 'modeline' might be off 59 au BufNewFile,BufRead */doc/*.txt 60 \ if getline('$') =~ '\%(^\|\s\)vim:\%(.*\%(:\|\s\)\)\?\%(ft\|filetype\)=help\%(:\|\s\|$\)' 61 \| setf help 62 \| endif 63 64 " Detect by name 65 au BufNewFile,BufRead * call dist#ft#DetectFromName() 66 67 " Abaqus or Trasys 68 au BufNewFile,BufRead *.inp call dist#ft#Check_inp() 69 70 " A2ps printing utility 71 au BufNewFile,BufRead */etc/a2ps.cfg,*/etc/a2ps/*.cfg,a2psrc,.a2psrc setf a2ps 72 73 " Ada (83, 9X, 95) 74 if has("vms") 75 au BufNewFile,BufRead *.gpr,*.ada_m,*.adc setf ada 76 else 77 au BufNewFile,BufRead *.gpr setf ada 78 endif 79 80 " Apache config file 81 au BufNewFile,BufRead .htaccess,*/etc/httpd/*.conf setf apache 82 au BufNewFile,BufRead */etc/apache2/sites-*/*.com setf apache 83 84 " ALSA configuration 85 au BufNewFile,BufRead .asoundrc,*/usr/share/alsa/alsa.conf,*/etc/asound.conf setf alsaconf 86 87 " APT config file 88 au BufNewFile,BufRead */.aptitude/config setf aptconf 89 " more generic pattern far down 90 91 " Arch Inventory file 92 au BufNewFile,BufRead .arch-inventory,=tagging-method setf arch 93 94 " atlas or kawasaki_as 95 au BufNewFile,BufRead *.as call dist#ft#FTas() 96 97 " Active Server Pages (with Visual Basic Script) 98 au BufNewFile,BufRead *.asa 99 \ if exists("g:filetype_asa") | 100 \ exe "setf " . g:filetype_asa | 101 \ else | 102 \ setf aspvbs | 103 \ endif 104 105 " Active Server Pages (with Perl or Visual Basic Script) 106 au BufNewFile,BufRead *.asp 107 \ if exists("g:filetype_asp") | 108 \ exe "setf " . g:filetype_asp | 109 \ elseif getline(1) . getline(2) . getline(3) =~? "perlscript" | 110 \ setf aspperl | 111 \ else | 112 \ setf aspvbs | 113 \ endif 114 115 " Grub (must be before pattern *.lst) 116 au BufNewFile,BufRead */boot/grub/menu.lst,*/boot/grub/grub.conf,*/etc/grub.conf setf grub 117 118 " Maxima, see: 119 " https://maxima.sourceforge.io/docs/manual/maxima_71.html#file_005ftype_005fmaxima 120 " Must be before the pattern *.mac. 121 " *.dem omitted - also used by gnuplot demos 122 " *.mc omitted - used by dist#ft#McSetf() 123 au BufNewFile,BufRead *.demo,*.dm{1,2,3,t},*.wxm,maxima-init.mac setf maxima 124 125 " ObjectScript routine or assembly 126 au BufNewFile,BufRead *.mac call dist#ft#FTmac() 127 128 " Argo CD configuration 129 au BufNewFile,BufRead */argocd/config setf yaml 130 131 " Assembly (all kinds) 132 " *.lst is not pure assembly, it has two extra columns (address, byte codes) 133 " *.[sS], *.[aA] usually Assembly - GNU 134 au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.lst call dist#ft#FTasm() 135 136 " BASIC or Visual Basic 137 au BufNewFile,BufRead *.bas call dist#ft#FTbas() 138 au BufNewFile,BufRead *.bi,*.bm call dist#ft#FTbas() 139 140 " Batch file for MSDOS. See dist#ft#FTsys for *.sys 141 " *.cmd is close to a Batch file, but on OS/2 Rexx files and TI linker command files also use *.cmd. 142 " lnk: `/* comment */`, `// comment`, and `--linker-option=value` 143 " rexx: `/* comment */`, `-- comment` 144 au BufNewFile,BufRead *.cmd 145 \ if join(getline(1, 20), "\n") =~ 'MEMORY\|SECTIONS\|\%(^\|\n\)--\S\|\%(^\|\n\)//' 146 \| setf lnk 147 \| elseif getline(1) =~ '^/\*' 148 \| setf rexx 149 \| else 150 \| setf dosbatch 151 \| endif 152 " ABB RAPID or Batch file for MSDOS. 153 au BufNewFile,BufRead *.sys call dist#ft#FTsys() 154 if has("fname_case") 155 au BufNewFile,BufRead *.Sys,*.SYS call dist#ft#FTsys() 156 endif 157 au BufNewFile,BufRead *.sysx setf rapid 158 if has("fname_case") 159 au BufNewFile,BufRead *.sysX,*.Sysx,*.SysX,*.SYSX,*.SYSx setf rapid 160 endif 161 162 " Batch file for 4DOS 163 au BufNewFile,BufRead *.btm call dist#ft#FTbtm() 164 165 " BIND configuration 166 " sudoedit uses namedXXXX.conf 167 au BufNewFile,BufRead named*.conf,rndc*.conf,rndc*.key setf named 168 169 " BIND zone 170 au BufNewFile,BufRead *.db call dist#ft#BindzoneCheck('') 171 172 " Blade 173 au BufNewFile,BufRead *.blade.php setf blade 174 175 " Bitbake 176 au BufNewFile,BufRead *.bb,*.bbappend,*.bbclass,*/build/conf/*.conf,*/meta{-*,}/conf/*.conf,*/project-spec/configs/*.conf setf bitbake 177 178 " Blkid cache file 179 au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old setf xml 180 181 " Bazel (https://bazel.build) and Buck2 (https://buck2.build/) 182 au BufNewFile,BufRead *.bzl,*.bxl,*.bazel,WORKSPACE,WORKSPACE.bzlmod setf bzl 183 if has("fname_case") 184 " There is another check for BUILD and BUCK further below. 185 au BufNewFile,BufRead *.BUILD,BUILD,BUCK setf bzl 186 endif 187 188 " Bazel rc file, the workspace location used before Bazel 0.17 189 au BufNewFile,BufRead */tools/bazel.rc setf bazelrc 190 191 " Bundle config 192 au BufNewFile,BufRead */.bundle/config setf yaml 193 194 " C or lpc 195 au BufNewFile,BufRead *.c call dist#ft#FTlpc() 196 au BufNewFile,BufRead *.lpc,*.ulpc setf lpc 197 198 " m17n database files. */m17n/* matches installed files, */.m17n.d/* matches 199 " per-user config files, */m17n-db/* matches the git repo. (must be before 200 " *.cs) 201 au BufNewFile,BufRead */{m17n,.m17n.d,m17n-db}/*.{ali,cs,dir,flt,fst,lnm,mic,mim,tbl} setf m17ndb 202 203 " Cdrdao TOC or LaTeX \tableofcontents files 204 au BufNewFile,BufRead *.toc 205 \ if getline(1) =~# '\\contentsline' |setf tex|else|setf cdrtoc|endif 206 207 " Cdrdao config 208 au BufNewFile,BufRead */etc/cdrdao.conf,*/etc/defaults/cdrdao,*/etc/default/cdrdao,.cdrdao setf cdrdaoconf 209 210 " Containers config files 211 au BufNewFile,BufRead */containers/containers.conf{,.d/*.conf} setf toml 212 au BufNewFile,BufRead */containers/containers.conf.modules/*.conf setf toml 213 au BufNewFile,BufRead */containers/registries.conf{,.d/*.conf} setf toml 214 au BufNewFile,BufRead */containers/storage.conf setf toml 215 216 " Cynlib 217 " .cc and .cpp files can be C++ or Cynlib. 218 au BufNewFile,BufRead *.cc 219 \ if exists("cynlib_syntax_for_cc")|setf cynlib|else|setf cpp|endif 220 au BufNewFile,BufRead *.cpp 221 \ if exists("cynlib_syntax_for_cpp")|setf cynlib|else|setf cpp|endif 222 223 " C++ 224 if has("fname_case") 225 au BufNewFile,BufRead *.C,*.H if !&fileignorecase | setf cpp | endif 226 endif 227 228 " .h files can be C, C++, Ch, Objective-C, or Objective-C++. 229 " Set g_filetype_h to set a different filetype 230 au BufNewFile,BufRead *.h call dist#ft#FTheader() 231 232 " Changelog 233 au BufNewFile,BufRead changelog.Debian,changelog.dch,NEWS.Debian,NEWS.dch,*/debian/changelog 234 \ setf debchangelog 235 236 au BufNewFile,BufRead [cC]hange[lL]og 237 \ if getline(1) =~ '; urgency=' 238 \| setf debchangelog 239 \| else 240 \| setf changelog 241 \| endif 242 243 au BufNewFile,BufRead NEWS 244 \ if getline(1) =~ '; urgency=' 245 \| setf debchangelog 246 \| endif 247 248 " CHILL 249 au BufNewFile,BufRead *..ch setf chill 250 251 " Changes for WEB and CWEB or CHILL 252 au BufNewFile,BufRead *.ch call dist#ft#FTchange() 253 254 " Clang-format 255 au BufNewFile,BufRead .clang-format setf yaml 256 257 " Clang-tidy 258 au BufNewFile,BufRead .clang-tidy setf yaml 259 260 " Matplotlib 261 au BufNewFile,BufRead *.mplstyle,matplotlibrc setf yaml 262 263 " Clever or dtd 264 au BufNewFile,BufRead *.ent call dist#ft#FTent() 265 266 " Clipper, FoxPro, ABB RAPID or eviews 267 au BufNewFile,BufRead *.prg call dist#ft#FTprg() 268 if has("fname_case") 269 au BufNewFile,BufRead *.Prg,*.PRG call dist#ft#FTprg() 270 endif 271 272 " Cmake 273 au BufNewFile,BufRead CMakeLists.txt,*.cmake,*.cmake.in setf cmake 274 275 " Cmusrc 276 au BufNewFile,BufRead */.cmus/{autosave,rc,command-history,*.theme} setf cmusrc 277 au BufNewFile,BufRead */cmus/{rc,*.theme} setf cmusrc 278 279 " Cobol 280 " cobol or zope form controller python script? (heuristic) 281 au BufNewFile,BufRead *.cpy 282 \ if getline(1) =~ '^##' | 283 \ setf python | 284 \ else | 285 \ setf cobol | 286 \ endif 287 288 " Dockerfile; Podman uses the same syntax with name Containerfile 289 " Also see Dockerfile.* below. 290 au BufNewFile,BufRead Containerfile,Dockerfile,dockerfile setf dockerfile 291 292 " Enlightenment configuration files 293 au BufNewFile,BufRead *enlightenment/*.cfg setf c 294 295 " Eterm 296 au BufNewFile,BufRead *Eterm/*.cfg setf eterm 297 298 " Elixir or Euphoria 299 au BufNewFile,BufRead *.ex call dist#ft#ExCheck() 300 301 " Elixir 302 au BufNewFile,BufRead mix.lock,*.exs setf elixir 303 au BufNewFile,BufRead *.eex,*.leex setf eelixir 304 305 " Euphoria 3 or 4 306 au BufNewFile,BufRead *.eu,*.ew,*.exu,*.exw call dist#ft#EuphoriaCheck() 307 if has("fname_case") 308 au BufNewFile,BufRead *.EU,*.EW,*.EX,*.EXU,*.EXW call dist#ft#EuphoriaCheck() 309 endif 310 311 " Evcxr history 312 au BufNewFile,BufRead */evcxr/history.txt setf rust 313 314 " Execline (s6) scripts 315 au BufNewFile,BufRead *s6*/\(up\|down\|run\|finish\) setf execline 316 317 " Faust 318 au BufNewFile,BufRead *.dsp call dist#ft#FTdsp() 319 320 " Modula-3 configuration language (must be before *.cfg and *makefile) 321 au BufNewFile,BufRead *.quake,cm3.cfg setf m3quake 322 au BufNewFile,BufRead m3makefile,m3overrides setf m3build 323 324 " Many tools written in Python use dosini as their config 325 " like setuptools, pudb, coverage, pypi, gitlint, oelint-adv, pylint, bpython, mypy 326 " (must be before *.cfg) 327 au BufNewFile,BufRead {.,}pylintrc,*/bpython/config,*/mypy/config setf dosini 328 329 " Many tools written in Python use toml as their config, like black 330 au BufNewFile,BufRead black 331 \ if getline(1) =~ 'tool.back' 332 \| setf toml 333 \| endif 334 335 " LXQt's programs use dosini as their config 336 au BufNewFile,BufRead */{lxqt,screengrab}/*.conf setf dosini 337 338 " Quake 339 au BufNewFile,BufRead *baseq[2-3]/*.cfg,*id1/*.cfg setf quake 340 au BufNewFile,BufRead *quake[1-3]/*.cfg setf quake 341 342 " LaTeX packages use LaTeX as their configuration, such as: 343 " ~/.texlive/texmf-config/tex/latex/hyperref/hyperref.cfg 344 " ~/.texlive/texmf-config/tex/latex/docstrip/docstrip.cfg 345 au BufNewFile,BufRead */tex/latex/**.cfg setf tex 346 347 " Configure files 348 au BufNewFile,BufRead *.cfg call dist#ft#FTcfg() 349 if has("fname_case") 350 au BufNewFile,BufRead *.Cfg,*.CFG call dist#ft#FTcfg() 351 endif 352 353 " Debian autopkgtest 354 au BufNewFile,BufRead */debian/tests/control setf autopkgtest 355 356 " Debian Control 357 au BufNewFile,BufRead */{debian,DEBIAN}/control setf debcontrol 358 au BufNewFile,BufRead control 359 \ if getline(1) =~ '^Source:\|^Package:' 360 \| setf debcontrol 361 \| elseif getline(1) =~ '^Tests:\|^Test-Command:' 362 \| setf autopkgtest 363 \| endif 364 365 " Debian Copyright 366 au BufNewFile,BufRead */debian/copyright setf debcopyright 367 au BufNewFile,BufRead copyright 368 \ if getline(1) =~ '^Format:' 369 \| setf debcopyright 370 \| endif 371 372 " Debian Sources.list 373 au BufNewFile,BufRead */etc/apt/sources.list setf debsources 374 au BufNewFile,BufRead */etc/apt/sources.list.d/*.list setf debsources 375 au BufNewFile,BufRead */etc/apt/sources.list.d/*.sources setf deb822sources 376 377 " dnsmasq(8) configuration files 378 au BufNewFile,BufRead */etc/dnsmasq.conf setf dnsmasq 379 380 " the D language or dtrace 381 au BufNewFile,BufRead */dtrace/*.d setf dtrace 382 au BufNewFile,BufRead *.d call dist#ft#DtraceCheck() 383 384 " Dictd config 385 au BufNewFile,BufRead dictd*.conf setf dictdconf 386 387 " DEP3 formatted patch files 388 au BufNewFile,BufRead */debian/patches/* call dist#ft#Dep3patch() 389 390 " Diff files 391 au BufNewFile,BufRead *.patch 392 \ if getline(1) =~# '^From [0-9a-f]\{40,\} Mon Sep 17 00:00:00 2001$' | 393 \ setf gitsendemail | 394 \ else | 395 \ setf diff | 396 \ endif 397 398 " Dircolors 399 au BufNewFile,BufRead .dir_colors,.dircolors,*/etc/DIR_COLORS setf dircolors 400 401 " Diva (with Skill) or InstallShield 402 au BufNewFile,BufRead *.rul 403 \ if getline(1).getline(2).getline(3).getline(4).getline(5).getline(6) =~? 'InstallShield' | 404 \ setf ishd | 405 \ else | 406 \ setf diva | 407 \ endif 408 409 " DCL (Digital Command Language - vms) or DNS zone file 410 au BufNewFile,BufRead *.com call dist#ft#BindzoneCheck('dcl') 411 412 " Dune 413 au BufNewFile,BufRead jbuild,dune,dune-project,dune-workspace,dune-file setf dune 414 415 " Microsoft Module Definition or Modula-2 416 au BufNewFile,BufRead *.def call dist#ft#FTdef() 417 418 if has("fname_case") 419 au BufNewFile,BufRead *.DEF setf modula2 420 endif 421 422 " dsl: DSSSL or Structurizr 423 au BufNewFile,BufRead *.dsl 424 \ if getline(1) =~ '^\s*<\!' | 425 \ setf dsl | 426 \ else | 427 \ setf structurizr | 428 \ endif 429 430 " EDIF (*.edf,*.edif,*.edn,*.edo) or edn 431 au BufNewFile,BufRead *.ed\(f\|if\|o\) setf edif 432 au BufNewFile,BufRead *.edn 433 \ if getline(1) =~ '^\s*(\s*edif\>' | 434 \ setf edif | 435 \ else | 436 \ setf clojure | 437 \ endif 438 439 " Eiffel or Specman or Euphoria 440 au BufNewFile,BufRead *.e,*.E call dist#ft#FTe() 441 442 " Elm Filter Rules file 443 au BufNewFile,BufRead filter-rules setf elmfilt 444 445 " Erlang Application Resource Files 446 au BufNewFile,BufRead *.app.src setf erlang 447 au BufNewFile,BufRead *.app call dist#ft#FTapp() 448 449 " ESMTP rc file 450 au BufNewFile,BufRead *esmtprc setf esmtprc 451 452 " Fennel 453 au BufNewFile,BufRead {,.}fennelrc setf fennel 454 455 " Flatpak config 456 au BufNewFile,BufRead */flatpak/repo/config setf dosini 457 458 " Fortran 459 if has("fname_case") 460 au BufNewFile,BufRead *.F,*.FOR,*.FPP,*.FTN,*.F77,*.F90,*.F95,*.F03,*.F08 setf fortran 461 endif 462 au BufNewFile,BufRead *.for,*.fortran,*.fpp,*.ftn,*.f77,*.f90,*.f95,*.f03,*.f08 setf fortran 463 464 " Fortran or Forth 465 au BufNewFile,BufRead *.f call dist#ft#FTf() 466 467 " F# or Forth 468 au BufNewFile,BufRead *.fs call dist#ft#FTfs() 469 470 " GDB command files 471 au BufNewFile,BufRead .gdbinit,gdbinit,.cuda-gdbinit,cuda-gdbinit,.gdbearlyinit,gdbearlyinit,*.gdb setf gdb 472 473 " Gedcom 474 au BufNewFile,BufRead *.ged,lltxxxxx.txt setf gedcom 475 476 " Git 477 au BufNewFile,BufRead *.git/config,.gitconfig,*/etc/gitconfig setf gitconfig 478 au BufNewFile,BufRead */.config/git/config setf gitconfig 479 au BufNewFile,BufRead *.git/config.worktree setf gitconfig 480 au BufNewFile,BufRead *.git/worktrees/*/config.worktree setf gitconfig 481 au BufNewFile,BufRead .gitmodules,*.git/modules/*/config setf gitconfig 482 if exists('$XDG_CONFIG_HOME') 483 au BufNewFile,BufRead $XDG_CONFIG_HOME/git/config setf gitconfig 484 au BufNewFile,BufRead $XDG_CONFIG_HOME/git/attributes setf gitattributes 485 au BufNewFile,BufRead $XDG_CONFIG_HOME/git/ignore setf gitignore 486 endif 487 au BufNewFile,BufRead .gitattributes,*.git/info/attributes setf gitattributes 488 au BufNewFile,BufRead */.config/git/attributes setf gitattributes 489 au BufNewFile,BufRead */etc/gitattributes setf gitattributes 490 au BufNewFile,BufRead .gitignore,*.git/info/exclude setf gitignore 491 au BufNewFile,BufRead */.config/git/ignore,*.prettierignore setf gitignore 492 au BufNewFile,BufRead */.config/fd/ignore,.fdignore,.ignore setf gitignore 493 au BufNewFile,BufRead .rgignore,.dockerignore,.containerignore setf gitignore 494 au BufNewFile,BufRead .npmignore,.vscodeignore setf gitignore 495 au BufNewFile,BufRead git-rebase-todo setf gitrebase 496 au BufNewFile,BufRead .gitsendemail.msg.?????? setf gitsendemail 497 au BufNewFile,BufRead *.git/* 498 \ if getline(1) =~# '^\x\{40,\}\>\|^ref: ' | 499 \ setf git | 500 \ endif 501 502 " Gkrellmrc 503 au BufNewFile,BufRead gkrellmrc,gkrellmrc_? setf gkrellmrc 504 505 " GP scripts (2.0 and onward) 506 au BufNewFile,BufRead *.gp,.gprc setf gp 507 508 " GPG 509 au BufNewFile,BufRead */.gnupg/options setf gpg 510 au BufNewFile,BufRead */.gnupg/gpg.conf setf gpg 511 au BufNewFile,BufRead */usr/*/gnupg/options.skel setf gpg 512 if !empty($GNUPGHOME) 513 au BufNewFile,BufRead $GNUPGHOME/options setf gpg 514 au BufNewFile,BufRead $GNUPGHOME/gpg.conf setf gpg 515 endif 516 517 " Gitolite 518 au BufNewFile,BufRead {,.}gitolite.rc,example.gitolite.rc setf perl 519 520 " Gnuplot scripts 521 au BufNewFile,BufRead *.gpi,*.gnuplot,.gnuplot_history setf gnuplot 522 523 " GNU Radio Companion files 524 au BufNewFile,BufRead *.grc 525 \ if getline(1) =~# '<?xml' | 526 \ setf xml | 527 \ else | 528 \ setf yaml | 529 \ endif 530 531 " Groovy 532 au BufNewFile,BufRead *.gradle,*.groovy,Jenkinsfile setf groovy 533 534 " Group file 535 au BufNewFile,BufRead */etc/group,*/etc/group-,*/etc/group.edit,*/etc/gshadow,*/etc/gshadow-,*/etc/gshadow.edit,*/var/backups/group.bak,*/var/backups/gshadow.bak setf group 536 537 " Hare 538 au BufNewFile,BufRead README call dist#ft#FTharedoc() 539 540 " Haskell 541 au BufNewFile,BufRead */{.,}cabal/config setf cabalconfig 542 au BufNewFile,BufRead cabal.config setf cabalconfig 543 au BufNewFile,BufRead *.persistentmodels setf haskellpersistent 544 545 " Tilde (must be before HTML) 546 au BufNewFile,BufRead *.t.html setf tilde 547 548 " Translate shell 549 au BufNewFile,BufRead init.trans,*/etc/translate-shell,.trans setf clojure 550 551 " HTML (.stm for server side, .shtml is server-side or superhtml) 552 au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm call dist#ft#FThtml() 553 554 " Host config 555 au BufNewFile,BufRead */etc/host.conf setf hostconf 556 557 " Hosts access 558 au BufNewFile,BufRead */etc/hosts.allow,*/etc/hosts.deny setf hostsaccess 559 560 " Hy 561 au BufNewFile,BufRead *.hy,.hy-history setf hy 562 563 " Hyprland Configuration language 564 au BufNewFile,BufRead */hypr/*.conf,hypr\(land\|paper\|idle\|lock\).conf setf hyprlang 565 566 " i3 567 au BufNewFile,BufRead */i3/config setf i3config 568 au BufNewFile,BufRead */.i3/config setf i3config 569 570 " sway 571 au BufNewFile,BufRead */sway/config setf swayconfig 572 au BufNewFile,BufRead */sway/config.d/* setf swayconfig 573 au BufNewFile,BufRead */.sway/config setf swayconfig 574 575 " IDL (Interface Description Language) 576 au BufNewFile,BufRead *.idl call dist#ft#FTidl() 577 578 " Icewm menu 579 au BufNewFile,BufRead */.icewm/menu setf icemenu 580 581 " Indent profile (must come before IDL *.pro!) 582 au BufNewFile,BufRead indent.pro call dist#ft#ProtoCheck('indent') 583 584 " IDL (Interactive Data Language), Prolog, Cproto or zsh module C 585 au BufNewFile,BufRead *.pro call dist#ft#ProtoCheck('idlang') 586 587 " Initng 588 au BufNewFile,BufRead */etc/initng/*/*.i,*.ii setf initng 589 590 " Intel HEX or ObjectScript routine 591 au BufNewFile,BufRead *.int call dist#ft#FTint() 592 593 " Innovation Data Processing 594 au BufNewFile,BufRead upstream.dat\c,upstream.*.dat\c,*.upstream.dat\c setf upstreamdat 595 au BufNewFile,BufRead fdrupstream.log,upstream.log\c,upstream.*.log\c,*.upstream.log\c,UPSTREAM-*.log\c setf upstreamlog 596 au BufNewFile,BufRead upstreaminstall.log\c,upstreaminstall.*.log\c,*.upstreaminstall.log\c setf upstreaminstalllog 597 au BufNewFile,BufRead usserver.log\c,usserver.*.log\c,*.usserver.log\c setf usserverlog 598 au BufNewFile,BufRead usw2kagt.log\c,usw2kagt.*.log\c,*.usw2kagt.log\c setf usw2kagtlog 599 600 " Java Properties resource file (note: doesn't catch font.properties.pl) 601 au BufNewFile,BufRead *.properties,*.properties_??,*.properties_??_?? setf jproperties 602 " Eclipse preference files use Java Properties syntax 603 au BufNewFile,BufRead org.eclipse.*.prefs setf jproperties 604 605 " JSONC (JSON with comments) 606 au BufNewFile,BufRead *.jsonc,.babelrc,.eslintrc,.jsfmtrc,bun.lock setf jsonc 607 au BufNewFile,BufRead .jshintrc,.jscsrc,.vsconfig,.hintrc,.swrc,[jt]sconfig*.json setf jsonc 608 " Visual Studio Code settings 609 au BufNewFile,BufRead ~/*/{Code,VSCodium}/User/*.json setf jsonc 610 611 " Just 612 au BufNewFile,BufRead \c{,*.}justfile,\c*.just setf just 613 614 " Kitty 615 au BufNewFile,BufRead kitty.conf,*/kitty/*.conf setf kitty 616 617 " Kuka Robot Language 618 au BufNewFile,BufRead *.src call dist#ft#FTsrc() 619 au BufNewFile,BufRead *.dat call dist#ft#FTdat() 620 au BufNewFile,BufRead *.sub setf krl 621 if has("fname_case") 622 au BufNewFile,BufRead *.Src,*.SRC call dist#ft#FTsrc() 623 au BufNewFile,BufRead *.Dat,*.DAT call dist#ft#FTdat() 624 au BufNewFile,BufRead *.Sub,*.SUB setf krl 625 endif 626 627 " Lalrpop 628 au BufNewFile,Bufread *.lalrpop setf lalrpop 629 630 " Larch Shared Language 631 au BufNewFile,BufRead .lsl call dist#ft#FTlsl() 632 633 " Limits 634 au BufNewFile,BufRead */etc/limits,*/etc/*limits.conf,*/etc/*limits.d/*.conf setf limits 635 636 " LambdaProlog or SML (see dist#ft#FTmod for *.mod) 637 au BufNewFile,BufRead *.sig call dist#ft#FTsig() 638 639 " Ld loader 640 au BufNewFile,BufRead *.ld,*/ldscripts/* setf ld 641 642 " Libao 643 au BufNewFile,BufRead */etc/libao.conf,*/.libao setf libao 644 645 " Libsensors 646 au BufNewFile,BufRead */etc/sensors.conf,*/etc/sensors3.conf setf sensors 647 648 " LFTP 649 au BufNewFile,BufRead lftp.conf,.lftprc,*lftp/rc setf lftp 650 651 " Lifelines, LLVM, or Lex for C++ 652 au BufNewFile,BufRead *.ll call dist#ft#FTll() 653 654 " Lisp (*.el = ELisp) 655 " *.jl was removed, it's also used for Julia, better skip than guess wrong. 656 if has("fname_case") 657 au BufNewFile,BufRead *.lsp,*.lisp,*.asd,*.el,*.L,.emacs,.sawfishrc setf lisp 658 else 659 au BufNewFile,BufRead *.lsp,*.lisp,*.asd,*.el,.emacs,.sawfishrc setf lisp 660 endif 661 662 " *.cl = Common Lisp or OpenCL 663 au BufNewFile,BufRead *.cl call dist#ft#FTcl() 664 665 " LiteStep RC files 666 au BufNewFile,BufRead */LiteStep/*/*.rc setf litestep 667 668 " Login access 669 au BufNewFile,BufRead */etc/login.access setf loginaccess 670 671 " Login defs 672 au BufNewFile,BufRead */etc/login.defs setf logindefs 673 674 " LOTOS or LaTeX \listoftables files 675 au BufNewFile,BufRead *.lot 676 \ if getline(1) =~# '\\contentsline' |setf tex|else|setf lotos|endif 677 678 " Lua, Texlua 679 au BufNewFile,BufRead *.lua,*.tlu,.lua_history setf lua 680 681 " Luarocks 682 au BufNewFile,BufRead *.rockspec,rock_manifest setf lua 683 684 " Linden Scripting Language (Second Life) 685 au BufNewFile,BufRead *.lsl call dist#ft#FTlsl() 686 687 " M4 688 au BufNewFile,BufRead *.m4 call dist#ft#FTm4() 689 690 au BufNewFile,BufRead .m4_history setf m4 691 692 " Mail (for Elm, trn, mutt, muttng, rn, slrn, neomutt) 693 au BufNewFile,BufRead snd.\d\+,.letter,.letter.\d\+,.followup,.article,.article.\d\+,pico.\d\+,mutt{ng,}-*-\w\+,mutt[[:alnum:]_-]\\\{6\},neomutt-*-\w\+,neomutt[[:alnum:]_-]\\\{6\},ae\d\+.txt,/tmp/SLRN[0-9A-Z.]\+,*.eml setf mail 694 695 " Mail aliases 696 au BufNewFile,BufRead */etc/mail/aliases,*/etc/aliases setf mailaliases 697 698 " Makefile 699 au BufNewFile,BufRead *[mM]akefile,*.mk,*.mak call dist#ft#FTmake() 700 au BufNewFile,BufRead Kbuild setf make 701 702 " Man config 703 au BufNewFile,BufRead */etc/man.conf,man.config setf manconf 704 705 " Map (UMN mapserver config file) 706 au BufNewFile,BufRead *.map 707 \ if getline(1) =~ '^\*\+$' | 708 \ setf lnkmap | 709 \ else | 710 \ setf map | 711 \ endif 712 713 " Markdown 714 au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,*.mdwn,*.md 715 \ if exists("g:filetype_md") | 716 \ exe "setf " . g:filetype_md | 717 \ else | 718 \ setf markdown | 719 \ endif 720 721 " Mathematica, Matlab, Murphi, Objective C or Octave 722 au BufNewFile,BufRead *.m call dist#ft#FTm() 723 724 " mbsync 725 au BufNewFile,BufRead *.mbsyncrc,isyncrc setf mbsync 726 727 " Mercurial (hg) commit file 728 au BufNewFile,BufRead hg-editor-*.txt setf hgcommit 729 730 " Mercurial config (looks like generic config file) 731 au BufNewFile,BufRead *.hgrc,*hgrc setf cfg 732 733 " MetaPost 734 au BufNewFile,BufRead *.mpxl,*.mpiv,*.mpvi let b:mp_metafun = 1 | setf mp 735 736 " MMIX or VMS makefile 737 au BufNewFile,BufRead *.mms call dist#ft#FTmms() 738 739 " ABB Rapid, Modula-2, Modsim III or LambdaProlog 740 au BufNewFile,BufRead *.mod call dist#ft#FTmod() 741 if has("fname_case") 742 au BufNewFile,BufRead *.Mod,*.MOD call dist#ft#FTmod() 743 endif 744 au BufNewFile,BufRead *.modx setf rapid 745 if has("fname_case") 746 au BufNewFile,BufRead *.modX,*.Modx,*.ModX,*.MODX,*.MODx setf rapid 747 endif 748 749 " Modula-3 (.m3, .i3, .mg, .ig) 750 au BufNewFile,BufRead *.[mi][3g] setf modula3 751 752 " Modconf 753 au BufNewFile,BufRead */etc/modules.conf,*/etc/modules,*/etc/conf.modules setf modconf 754 755 " Mplayer config 756 au BufNewFile,BufRead mplayer.conf,*/.mplayer/config setf mplayerconf 757 758 " Mysql 759 au BufNewFile,BufRead *.mysql,.mysql_history setf mysql 760 761 " Tcl Shell RC file 762 " Vivado journal file records REPL input in tcl syntax 763 " Vivado log file records REPL input in tcl syntax and output 764 au BufNewFile,BufRead tclsh.rc,vivado*.{jou,log} setf tcl 765 766 " M$ Resource files 767 " /etc/Muttrc.d/file.rc is muttrc 768 au BufNewFile,BufRead *.rc,*.rch 769 \ if expand("<afile>") !~ "/etc/Muttrc.d/" | 770 \ setf rc | 771 \ endif 772 773 " Mojo 774 " Mojo files use either .mojo or .🔥 as extension 775 au BufNewFile,BufRead *.mojo,*.🔥 setf mojo 776 777 " Mutt setup file (also for Muttng) 778 au BufNewFile,BufRead Mutt{ng,}rc setf muttrc 779 780 " Neomutt log 781 au BufNewFile,BufRead *.neomuttdebug* setf neomuttlog 782 783 " Nano 784 au BufNewFile,BufRead */etc/nanorc,*.nanorc setf nanorc 785 786 " Nastran input/DMAP 787 "au BufNewFile,BufRead *.dat setf nastran 788 789 " Natural 790 au BufNewFile,BufRead *.NS[ACGLMNPS] setf natural 791 792 " Neofetch 793 au BufNewFile,BufRead */neofetch/config.conf setf sh 794 795 " Nginx 796 au BufNewFile,BufRead *.nginx,nginx*.conf,*nginx.conf,*/nginx/*.conf setf nginx 797 798 " Nroff/Groff/Troff (*.ms and *.t are checked below) 799 au BufNewFile,BufRead *.me 800 \ if expand("<afile>") != "read.me" && expand("<afile>") != "click.me" | 801 \ setf nroff | 802 \ endif 803 au BufNewFile,BufRead *.tr,*.nr,*.roff,*.tmac setf nroff 804 au BufNewFile,BufRead *.groff,*.mom setf groff 805 au BufNewFile,BufRead *.[0-9],*.[013]p,*.[1-8]x,*.3{am,perl,pm,posix,type},*.n call dist#ft#FTnroff() 806 807 " Nroff or Objective C++ 808 au BufNewFile,BufRead *.mm call dist#ft#FTmm() 809 810 " notmuch 811 au BufNewFile,BufRead .notmuch-config{,.*} setf dosini 812 au BufNewFile,BufRead ~/.config/notmuch/*/config setf dosini 813 if exists('$XDG_CONFIG_HOME') 814 au BufNewFile,BufRead $XDG_CONFIG_HOME/notmuch/*/config setf dosini 815 endif 816 817 " OCaml 818 au BufNewFile,BufRead *.ml,*.mli,*.mll,*.mly,.ocamlinit,*.mlt,*.mlp,*.mlip,*.mli.cppo,*.ml.cppo setf ocaml 819 820 " Octave 821 au BufNewFile,BufRead octave.conf,.octaverc,octaverc,*/octave/history setf octave 822 823 " OPAM 824 au BufNewFile,BufRead opam,*.opam,*.opam.template,opam.locked,*.opam.locked setf opam 825 826 " OpenFOAM 827 au BufNewFile,BufRead fvSchemes,fvSolution,fvConstrains,fvModels,*/constant/g call dist#ft#FTfoam() 828 829 " OPL 830 au BufNewFile,BufRead *.[Oo][Pp][Ll] setf opl 831 832 " ini style config files, using # comments 833 au BufNewFile,BufRead */.aws/config,*/.aws/credentials,*/.aws/cli/alias setf confini 834 au BufNewFile,BufRead *.nmconnection setf confini 835 au BufNewFile,BufRead paru.conf setf confini 836 au BufNewFile,BufRead */{,.}gnuradio/*.conf setf confini 837 au BufNewFile,BufRead */gnuradio/conf.d/*.conf setf confini 838 839 " Pacman hooks 840 au BufNewFile,BufRead *.hook 841 \ if getline(1) == '[Trigger]' | 842 \ setf confini | 843 \ endif 844 845 " Pacman makepkg 846 au BufNewFile,BufRead {.,}makepkg.conf setf sh 847 848 " Pacman log 849 au BufRead pacman.log* call s:StarSetf('pacmanlog') 850 851 " Pam conf 852 au BufNewFile,BufRead */etc/pam.conf setf pamconf 853 854 " Password file 855 au BufNewFile,BufRead */etc/passwd,*/etc/passwd-,*/etc/passwd.edit,*/etc/shadow,*/etc/shadow-,*/etc/shadow.edit,*/var/backups/passwd.bak,*/var/backups/shadow.bak setf passwd 856 857 " Pascal or Puppet manifest 858 au BufNewFile,BufRead *.pp call dist#ft#FTpp() 859 860 " Xilinx labtools project file or Lazarus program file 861 au BufNewFile,BufRead *.lpr 862 \ if getline(1) =~# "<?xml" | 863 \ setf xml | 864 \ else | 865 \ setf pascal | 866 \ endif 867 868 " Perl or Prolog 869 if has("fname_case") 870 au BufNewFile,BufRead *.pl,*.PL call dist#ft#FTpl() 871 else 872 au BufNewFile,BufRead *.pl call dist#ft#FTpl() 873 endif 874 au BufNewFile,BufRead *.plx,*.psgi setf perl 875 876 " Perl AutoLoader or AL (Dynamics 365 Business Central) 877 au BufNewFile,BufRead *.al call dist#ft#FTal() 878 879 " Perl, XPM or XPM2 880 au BufNewFile,BufRead *.pm 881 \ if getline(1) =~ "XPM2" | 882 \ setf xpm2 | 883 \ elseif getline(1) =~ "XPM" | 884 \ setf xpm | 885 \ else | 886 \ setf perl | 887 \ endif 888 889 " Php, php3, php4, etc. 890 " Also Phtml (was used for PHP 2 in the past). 891 " Also .ctp for Cake template file. 892 " Also .phpt for php tests. 893 " Also .theme for Drupal theme files. 894 au BufNewFile,BufRead *.php,*.php\d,*.phtml,*.ctp,*.phpt,*.theme setf php 895 896 " Pinfo config 897 au BufNewFile,BufRead */etc/pinforc,*/.pinforc setf pinfo 898 899 " Pip requirements 900 au BufNewFile,BufRead *-requirements.txt setf requirements 901 au BufNewFile,BufRead requirements-*.txt setf requirements 902 au BufNewFile,BufRead constraints.txt setf requirements 903 au BufNewFile,BufRead requirements.in setf requirements 904 au BufNewFile,BufRead requirements/*.txt setf requirements 905 au BufNewFile,BufRead requires/*.txt setf requirements 906 907 " Pkl 908 au BufNewFile,BufRead PklProject,*.pkl,*.pcf,pkl-lsp://* setf pkl 909 910 " WIC kickstarter files 911 au BufNewFile,BufRead *.wks,*.wks.in,*.wks.inc setf wks 912 913 " Portage 914 au BufNewFile,BufRead */portage/make.conf/*.conf,*/portage/make.conf setf sh 915 au BufNewFile,BufRead */portage/{bin,}repos.conf/*.conf setf confini 916 917 " Povray, Pascal, PHP or assembly 918 au BufNewFile,BufRead *.inc call dist#ft#FTinc() 919 920 " PowerShell 921 au BufNewFile,BufRead *.ps1,*.psd1,*.psm1,*.pssc setf ps1 922 au BufNewFile,BufRead *.ps1xml setf ps1xml 923 au BufNewFile,BufRead *.cdxml,*.psc1 setf xml 924 925 " Printcap and Termcap 926 au BufNewFile,BufRead *printcap 927 \ let b:ptcap_type = "print" | setf ptcap 928 au BufNewFile,BufRead *termcap 929 \ let b:ptcap_type = "term" | setf ptcap 930 931 " Progress or CWEB 932 au BufNewFile,BufRead *.w call dist#ft#FTprogress_cweb() 933 934 " Progress or assembly or Swig 935 au BufNewFile,BufRead *.i call dist#ft#FTi() 936 937 " Progress or Pascal 938 au BufNewFile,BufRead *.p call dist#ft#FTprogress_pascal() 939 940 " Software Distributor Product Specification File (POSIX 1387.2-1995) 941 au BufNewFile,BufRead INDEX,INFO 942 \ if getline(1) =~ '^\s*\(distribution\|installed_software\|root\|bundle\|product\)\s*$' | 943 \ setf psf | 944 \ endif 945 946 " Protocols 947 au BufNewFile,BufRead */etc/protocols setf protocols 948 949 " Python, Python Shell Startup and Python Stub Files 950 " Quixote (Python-based web framework) and IPython 951 au BufNewFile,BufRead *.py,*.pyw,.pythonstartup,.pythonrc,.python_history,.jline-jython.history setf python 952 au BufNewFile,BufRead *.ipy,*.ptl,*.pyi,SConstruct setf python 953 954 " RCS file 955 au BufNewFile,BufRead *\,v setf rcs 956 957 " Registry for MS-Windows 958 au BufNewFile,BufRead *.reg 959 \ if getline(1) =~? '^REGEDIT[0-9]*\s*$\|^Windows Registry Editor Version \d*\.\d*\s*$' | setf registry | endif 960 961 " Ripgrep rc 962 au BufNewFile,BufRead {.,}ripgreprc setf conf 963 964 " R Help file 965 if has("fname_case") 966 au BufNewFile,BufRead *.rd,*.Rd setf rhelp 967 else 968 au BufNewFile,BufRead *.rd setf rhelp 969 endif 970 971 " R noweb file 972 if has("fname_case") 973 au BufNewFile,BufRead *.Rnw,*.rnw,*.Snw,*.snw setf rnoweb 974 else 975 au BufNewFile,BufRead *.rnw,*.snw setf rnoweb 976 endif 977 978 " R Markdown file 979 if has("fname_case") 980 au BufNewFile,BufRead *.Rmd,*.rmd,*.Smd,*.smd setf rmd 981 else 982 au BufNewFile,BufRead *.rmd,*.smd setf rmd 983 endif 984 985 " R reStructuredText file 986 if has("fname_case") 987 au BufNewFile,BufRead *.Rrst,*.rrst,*.Srst,*.srst setf rrst 988 else 989 au BufNewFile,BufRead *.rrst,*.srst setf rrst 990 endif 991 992 " Rexx, Rebol or R 993 au BufNewFile,BufRead *.r,*.R call dist#ft#FTr() 994 995 " Remind 996 au BufNewFile,BufRead .reminders,*.remind,*.rem setf remind 997 998 " Rantfile and Rakefile is like Ruby 999 au BufNewFile,BufRead [rR]antfile,*.rant,[rR]akefile,*.rake setf ruby 1000 1001 " Rust 1002 au BufNewFile,BufRead Cargo.lock,*/.cargo/config,*/.cargo/credentials setf toml 1003 1004 " Sather, TI linear assembly 1005 au BufNewFile,BufRead *.sa call dist#ft#FTsa() 1006 1007 " SuperCollider 1008 au BufNewFile,BufRead *.sc call dist#ft#FTsc() 1009 1010 au BufNewFile,BufRead *.quark setf supercollider 1011 1012 " scdoc 1013 au BufNewFile,BufRead *.scd call dist#ft#FTscd() 1014 1015 1016 " Sendmail .mc files are actually m4. Could also be MS Message text file or 1017 " Maxima. 1018 au BufNewFile,BufRead *.mc call dist#ft#McSetf() 1019 1020 " Services 1021 au BufNewFile,BufRead */etc/services setf services 1022 1023 " Service Location config 1024 au BufNewFile,BufRead */etc/slp.conf setf slpconf 1025 1026 " Service Location registration 1027 au BufNewFile,BufRead */etc/slp.reg setf slpreg 1028 1029 " Service Location SPI 1030 au BufNewFile,BufRead */etc/slp.spi setf slpspi 1031 1032 " Setserial config 1033 au BufNewFile,BufRead */etc/serial.conf setf setserial 1034 1035 " SGML 1036 au BufNewFile,BufRead *.sgm,*.sgml 1037 \ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'linuxdoc' | 1038 \ setf sgmllnx | 1039 \ elseif getline(1) =~ '<!DOCTYPE.*DocBook' || getline(2) =~ '<!DOCTYPE.*DocBook' | 1040 \ let b:docbk_type = "sgml" | 1041 \ let b:docbk_ver = 4 | 1042 \ setf docbk | 1043 \ else | 1044 \ setf sgml | 1045 \ endif 1046 1047 " SGMLDECL 1048 au BufNewFile,BufRead *.decl,*.dcl,*.dec 1049 \ if getline(1).getline(2).getline(3) =~? '^<!SGML' | 1050 \ setf sgmldecl | 1051 \ endif 1052 1053 " Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc. 1054 " Gentoo ebuilds and Arch Linux PKGBUILDs are actually bash scripts. 1055 " NOTE: Patterns ending in a star are further down, these have lower priority. 1056 au BufNewFile,BufRead .bashrc,bashrc,bash.bashrc,.bash[_-]profile,.bash[_-]logout,.bash[_-]aliases,.bash[_-]history,bash-fc[-.],*.ebuild,*.bash,*.eclass,PKGBUILD,*.bats,*.cygport call dist#ft#SetFileTypeSH("bash") 1057 au BufNewFile,BufRead ~/.x{init,server}rc,/etc/X11/xinit/x{initrc{,.d/*},serverrc} setf sh 1058 au BufNewFile,BufRead .kshrc,*.ksh call dist#ft#SetFileTypeSH("ksh") 1059 au BufNewFile,BufRead */etc/profile,.profile,*.sh,*.envrc,.envrc.* call dist#ft#SetFileTypeSH(getline(1)) 1060 " Shell script (Arch Linux) or PHP file (Drupal) 1061 au BufNewFile,BufRead *.install 1062 \ if getline(1) =~ '<?php' | 1063 \ setf php | 1064 \ else | 1065 \ call dist#ft#SetFileTypeSH("bash") | 1066 \ endif 1067 1068 " tcsh scripts (patterns ending in a star further below) 1069 au BufNewFile,BufRead .tcshrc,*.tcsh,tcsh.tcshrc,tcsh.login call dist#ft#SetFileTypeShell("tcsh") 1070 1071 " csh scripts, but might also be tcsh scripts (on some systems csh is tcsh) 1072 " (patterns ending in a start further below) 1073 au BufNewFile,BufRead .login,.cshrc,csh.cshrc,csh.login,csh.logout,*.csh,.alias call dist#ft#CSH() 1074 1075 " Z-Shell script (patterns ending in a star further below) 1076 au BufNewFile,BufRead .zprofile,*/etc/zprofile,.zfbfmarks setf zsh 1077 au BufNewFile,BufRead .zshrc,.zshenv,.zlogin,.zlogout,.zcompdump,.zsh_history setf zsh 1078 au BufNewFile,BufRead *.zsh,*.zsh-theme,*.zunit setf zsh 1079 1080 " Scheme, Supertux configuration, Lips.js history, Guile init file ("racket" patterns are now separate, see above) 1081 au BufNewFile,BufRead *.scm,*.ss,*.sld,*.stwm,*.stl,*.stxt,*.sprite,*.strf,*.satc,*.stcd,*.stf,*.stcp,*.music,*.stsg,*/supertux2/config,*/supertux2/*/info,.lips_repl_history,.guile setf scheme 1082 1083 " SiSU 1084 au BufNewFile,BufRead *.sst.meta,*.-sst.meta,*._sst.meta setf sisu 1085 1086 " Smalltalk (and ObjectScript, Rexx, TeX, and Visual Basic) 1087 au BufNewFile,BufRead *.cls call dist#ft#FTcls() 1088 1089 " SMIL or XML 1090 au BufNewFile,BufRead *.smil 1091 \ if getline(1) =~ '<?\s*xml.*?>' | 1092 \ setf xml | 1093 \ else | 1094 \ setf smil | 1095 \ endif 1096 1097 " SMIL or SNMP MIB file 1098 au BufNewFile,BufRead *.smi 1099 \ if getline(1) =~ '\<smil\>' | 1100 \ setf smil | 1101 \ else | 1102 \ setf mib | 1103 \ endif 1104 1105 " Snakemake 1106 au BufNewFile,BufRead Snakefile,*.smk setf snakemake 1107 1108 " Snort Configuration 1109 au BufNewFile,BufRead *.hog,snort.conf,vision.conf setf hog 1110 au BufNewFile,BufRead *.rules call dist#ft#FTRules() 1111 1112 " *.typ can be either SQL or Typst files 1113 au BufNewFile,BufRead *.typ call dist#ft#FTtyp() 1114 1115 " SQL 1116 au BufNewFile,BufRead *.sql call dist#ft#SQL() 1117 au BufNewFile,BufRead .sqlite_history setf sql 1118 1119 " OpenSSH configuration 1120 au BufNewFile,BufRead ssh_config,*/.ssh/config,*/.ssh/*.conf setf sshconfig 1121 au BufNewFile,BufRead */etc/ssh/ssh_config.d/*.conf setf sshconfig 1122 1123 " OpenSSH server configuration 1124 au BufNewFile,BufRead */etc/ssh/sshd_config.d/*.conf setf sshdconfig 1125 1126 " OpenSSH public keys, authorized keys, signing keys, host keys 1127 au BufNewFile,BufRead */.ssh/?*.pub,/etc/ssh/?*.pub setf sshpublickey 1128 au BufNewFile,BufRead */.ssh/authorized_keys setf sshauthorizedkeys 1129 au BufNewFile,BufRead */.ssh/known_hosts,/etc/ssh/ssh_known_hosts setf sshknownhosts 1130 au BufNewFile,BufRead allowed_signers,*.allowed_signers setf sshallowedsigners 1131 1132 " OpenVPN configuration 1133 au BufNewFile,BufRead */openvpn/*/*.conf setf openvpn 1134 1135 " Stata 1136 " Also *.class, but not when it's a Java bytecode file 1137 au BufNewFile,BufRead *.class 1138 \ if getline(1) !~ "^\xca\xfe\xba\xbe" | setf stata | endif 1139 1140 " SPA JSON 1141 au BufNewFile,BufRead */pipewire/*.conf setf spajson 1142 au BufNewFile,BufRead */wireplumber/*.conf setf spajson 1143 1144 " Swift 1145 au BufNewFile,BufRead *.swift.gyb setf swiftgyb 1146 1147 " Swift Intermediate Language or SILE 1148 au BufNewFile,BufRead *.sil call dist#ft#FTsil() 1149 1150 " Sysctl 1151 au BufNewFile,BufRead */etc/sysctl.conf,*/etc/sysctl.d/*.conf setf sysctl 1152 1153 " Systemd unit files 1154 au BufNewFile,BufRead */systemd/*.{automount,dnssd,link,mount,netdev,network,nspawn,path,service,slice,socket,swap,target,timer} setf systemd 1155 " Systemd overrides 1156 au BufNewFile,BufRead */etc/systemd/*.conf.d/*.conf setf systemd 1157 au BufNewFile,BufRead */etc/systemd/system/*.d/*.conf setf systemd 1158 au BufNewFile,BufRead */.config/systemd/user/*.d/*.conf setf systemd 1159 " Systemd temp files 1160 au BufNewFile,BufRead */etc/systemd/system/*.d/.#* setf systemd 1161 au BufNewFile,BufRead */etc/systemd/system/.#* setf systemd 1162 au BufNewFile,BufRead */.config/systemd/user/*.d/.#* setf systemd 1163 au BufNewFile,BufRead */.config/systemd/user/.#* setf systemd 1164 " Podman Quadlet files 1165 au BufNewFile,BufRead */containers/systemd/*.{artifact,build,container,image,kube,network,pod,volume} setf systemd 1166 " Podman Quadlet rootless files not already captured by previous line 1167 au BufNewFile,BufRead */etc/containers/systemd/users/*/*.{artifact,build,container,image,kube,network,pod,volume} setf systemd 1168 au BufNewFile,BufRead */etc/containers/systemd/users/*.{artifact,build,container,image,kube,network,pod,volume} setf systemd 1169 " Podman Quadlet overrides 1170 au BufNewFile,BufRead */containers/systemd/*.d/*.conf setf systemd 1171 au BufNewFile,BufRead */etc/containers/systemd/users/*/*.d/*.conf setf systemd 1172 au BufNewFile,BufRead */etc/containers/systemd/users/*.d/*.conf setf systemd 1173 1174 " Sudoers 1175 au BufNewFile,BufRead */etc/sudoers,sudoers.tmp setf sudoers 1176 1177 " Tads (or Nroff or Perl test file) 1178 au BufNewFile,BufRead *.t 1179 \ if !dist#ft#FTnroff() && !dist#ft#FTperl() | setf tads | endif 1180 1181 " Task 1182 au BufNewFile,BufRead {pending,completed,undo}.data setf taskdata 1183 au BufNewFile,BufRead *.task setf taskedit 1184 1185 " Tcl (JACL too) 1186 au BufNewFile,BufRead *.tcl,*.tm,*.tk,*.itcl,*.itk,*.jacl,.tclshrc,.wishrc,.tclsh-history setf tcl 1187 1188 " Tera Term Language or Turtle 1189 au BufNewFile,BufRead *.ttl 1190 \ if getline(1) =~ '^@\?\(prefix\|base\)' | 1191 \ setf turtle | 1192 \ else | 1193 \ setf teraterm | 1194 \ endif 1195 1196 " TeX 1197 au BufNewFile,BufRead *.tex call dist#ft#FTtex() 1198 au BufNewFile,BufRead texdoc.cnf setf conf 1199 1200 " LaTeX packages will generate some medium LaTeX files during compiling 1201 " They should be ignored by .gitignore https://github.com/github/gitignore/blob/main/TeX.gitignore 1202 " Sometime we need to view its content for debugging 1203 au BufNewFile,BufRead *.{pgf,nlo,nls,thm,eps_tex,pygtex,pygstyle,clo,aux,brf,ind,lof,loe,nav,vrb,ins,tikz,bbx,cbx,beamer} setf tex 1204 1205 " TF (TinyFugue) mud client or terraform 1206 au BufNewFile,BufRead *.tf call dist#ft#FTtf() 1207 1208 " tmux configuration 1209 au BufNewFile,BufRead {.,}tmux*.conf setf tmux 1210 1211 " TOML 1212 au BufNewFile,BufRead *.toml,uv.lock setf toml 1213 1214 " TypeScript or Qt translation file (which is XML) 1215 au BufNewFile,BufRead *.ts 1216 \ if getline(1) =~ '<?xml' | 1217 \ setf xml | 1218 \ else | 1219 \ setf typescript | 1220 \ endif 1221 au BufNewFile,BufRead .ts_node_repl_history setf typescript 1222 1223 " Udev conf 1224 au BufNewFile,BufRead */etc/udev/udev.conf setf udevconf 1225 1226 " Udev permissions 1227 au BufNewFile,BufRead */etc/udev/permissions.d/*.permissions setf udevperm 1228 " 1229 " Udev symlinks config 1230 au BufNewFile,BufRead */etc/udev/cdsymlinks.conf setf sh 1231 1232 " Updatedb 1233 au BufNewFile,BufRead */etc/updatedb.conf setf updatedb 1234 1235 " Upstart (init(8)) config files 1236 au BufNewFile,BufRead */usr/share/upstart/*.conf setf upstart 1237 au BufNewFile,BufRead */usr/share/upstart/*.override setf upstart 1238 au BufNewFile,BufRead */etc/init/*.conf,*/etc/init/*.override setf upstart 1239 au BufNewFile,BufRead */.init/*.conf,*/.init/*.override setf upstart 1240 au BufNewFile,BufRead */.config/upstart/*.conf setf upstart 1241 au BufNewFile,BufRead */.config/upstart/*.override setf upstart 1242 1243 " Verilog HDL, V or Coq 1244 au BufNewFile,BufRead *.v call dist#ft#FTv() 1245 1246 " Vim script 1247 au BufNewFile,BufRead *.vim,.exrc,_exrc,.netrwhist setf vim 1248 1249 " Virata Config Script File or Drupal module 1250 au BufNewFile,BufRead *.hw,*.module,*.pkg 1251 \ if getline(1) =~ '<?php' | 1252 \ setf php | 1253 \ else | 1254 \ setf virata | 1255 \ endif 1256 1257 " Visual Basic (see also *.bas *.cls) 1258 1259 " Visual Basic or FORM 1260 au BufNewFile,BufRead *.frm call dist#ft#FTfrm() 1261 1262 " Visual Basic or Vimball Archiver 1263 au BufNewFile,BufRead *.vba call dist#ft#FTvba() 1264 1265 " Waybar config 1266 au BufNewFile,BufRead */waybar/config setf jsonc 1267 1268 " CVS commit file 1269 au BufNewFile,BufRead cvs\d\+ setf cvs 1270 1271 " WEB (*.web is also used for Winbatch: Guess, based on expecting "%" comment 1272 " lines in a WEB file). 1273 au BufNewFile,BufRead *.web 1274 \ if getline(1)[0].getline(2)[0].getline(3)[0].getline(4)[0].getline(5)[0] =~ "%" | 1275 \ setf web | 1276 \ else | 1277 \ setf winbatch | 1278 \ endif 1279 1280 " Windows Scripting Host and Windows Script Component 1281 au BufNewFile,BufRead *.ws[fc] setf wsh 1282 1283 " Xdg-user-dirs 1284 au BufNewFile,BufRead user-dirs.dirs,user-dirs.defaults setf sh 1285 1286 " X Pixmap (dynamically sets colors, this used to trigger on BufEnter to make 1287 " it work better, but that breaks setting 'filetype' manually) 1288 au BufNewFile,BufRead *.xpm 1289 \ if getline(1) =~ "XPM2" | 1290 \ setf xpm2 | 1291 \ else | 1292 \ setf xpm | 1293 \ endif 1294 au BufNewFile,BufRead *.xpm2 setf xpm2 1295 1296 " XFree86 config 1297 au BufNewFile,BufRead XF86Config 1298 \ if getline(1) =~ '\<XConfigurator\>' | 1299 \ let b:xf86conf_xfree86_version = 3 | 1300 \ endif | 1301 \ setf xf86conf 1302 au BufNewFile,BufRead */xorg.conf.d/*.conf 1303 \ let b:xf86conf_xfree86_version = 4 | 1304 \ setf xf86conf 1305 1306 " Xorg config 1307 au BufNewFile,BufRead xorg.conf,xorg.conf-4 let b:xf86conf_xfree86_version = 4 | setf xf86conf 1308 1309 " Xinetd conf 1310 au BufNewFile,BufRead */etc/xinetd.conf setf xinetd 1311 1312 " X resources file 1313 au BufNewFile,BufRead .Xdefaults,.Xpdefaults,.Xresources,xdm-config,*.ad setf xdefaults 1314 1315 " Xmath 1316 au BufNewFile,BufRead *.ms 1317 \ if !dist#ft#FTnroff() | setf xmath | endif 1318 1319 " XML specific variants: docbk and xbl 1320 au BufNewFile,BufRead *.xml call dist#ft#FTxml() 1321 1322 " CSPROJ files are Visual Studio.NET's XML-based C# project config files 1323 au BufNewFile,BufRead *.csproj,*.csproj.user setf xml 1324 1325 " FSPROJ files are Visual Studio.NET's XML-based F# project config files 1326 au BufNewFile,BufRead *.fsproj,*.fsproj.user setf xml 1327 1328 " VBPROJ files are Visual Studio.NET's XML-based Visual Basic project config files 1329 au BufNewFile,BufRead *.vbproj,*.vbproj.user setf xml 1330 1331 " Xdg menus 1332 au BufNewFile,BufRead */etc/xdg/menus/*.menu setf xml 1333 1334 " X11 xmodmap (also see below) 1335 au BufNewFile,BufRead *Xmodmap setf xmodmap 1336 1337 " Yacc or racc 1338 au BufNewFile,BufRead *.y call dist#ft#FTy() 1339 1340 " Yaml 1341 au BufNewFile,BufRead buf.lock,*/.kube/config,*/.kube/kuberc setf yaml 1342 1343 " yum conf (close enough to dosini) 1344 au BufNewFile,BufRead */etc/yum.conf setf dosini 1345 1346 " Zimbu 1347 " Zope 1348 " dtml (zope dynamic template markup language), pt (zope page template), 1349 " cpt (zope form controller page template) 1350 au BufNewFile,BufRead *.dtml,*.pt,*.cpt call dist#ft#FThtml() 1351 " zsql (zope sql method) 1352 au BufNewFile,BufRead *.zsql call dist#ft#SQL() 1353 1354 " Detect by extension 1355 au BufNewFile,BufRead * call dist#ft#DetectFromExt() 1356 augroup END 1357 1358 1359 " Source the user-specified filetype file, for backwards compatibility with 1360 " Vim 5.x. 1361 if exists("myfiletypefile") && filereadable(expand(myfiletypefile)) 1362 execute "source " . myfiletypefile 1363 endif 1364 1365 1366 " Check for "*" after loading myfiletypefile, so that scripts.vim is only used 1367 " when there are no matching file name extensions. 1368 " Don't do this for compressed files. 1369 augroup filetypedetect 1370 au BufNewFile,BufRead * 1371 \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat 1372 \ | runtime! scripts.vim | endif 1373 au StdinReadPost * if !did_filetype() | runtime! scripts.vim | endif 1374 1375 1376 " Plain text files, needs to be far down to not override others. This avoids 1377 " the "conf" type being used if there is a line starting with '#'. 1378 " But before patterns matching everything in a directory. 1379 au BufNewFile,BufRead *.text,README,LICENSE,COPYING,AUTHORS setf text 1380 1381 " What should *.out files be? Text? 1382 " Disabled until it is clear, to what this should be set 1383 "au BufNewFile,BufRead *.out setf text 1384 1385 1386 " Extra checks for when no filetype has been detected now. Mostly used for 1387 " patterns that end in "*". E.g., "zsh*" matches "zsh.vim", but that's a Vim 1388 " script file. 1389 " Most of these should call s:StarSetf() to avoid names ending in .gz and the 1390 " like are used. 1391 1392 " More Apache style config files 1393 au BufNewFile,BufRead */etc/proftpd/*.conf*,*/etc/proftpd/conf.*/* call s:StarSetf('apachestyle') 1394 au BufNewFile,BufRead proftpd.conf* call s:StarSetf('apachestyle') 1395 1396 " More Apache config files 1397 au BufNewFile,BufRead access.conf*,apache.conf*,apache2.conf*,httpd.conf*,httpd-*.conf*,srm.conf*,proxy-html.conf* call s:StarSetf('apache') 1398 au BufNewFile,BufRead */etc/apache2/*.conf*,*/etc/apache2/conf.*/*,*/etc/apache2/mods-*/*,*/etc/apache2/sites-*/*,*/etc/httpd/conf.*/*,*/etc/httpd/mods-*/*,*/etc/httpd/sites-*/*,*/etc/httpd/conf.d/*.conf* call s:StarSetf('apache') 1399 1400 " APT config file 1401 au BufNewFile,BufRead */etc/apt/apt.conf.d/{[-_[:alnum:]]\+,[-_.[:alnum:]]\+.conf} call s:StarSetf('aptconf') 1402 1403 " Asterisk config file 1404 au BufNewFile,BufRead *asterisk/*.conf* call s:StarSetf('asterisk') 1405 au BufNewFile,BufRead *asterisk*/*voicemail.conf* call s:StarSetf('asteriskvm') 1406 1407 " Bazaar version control 1408 au BufNewFile,BufRead bzr_log.* setf bzr 1409 1410 " Bazel and Buck2 build file 1411 if !has("fname_case") 1412 au BufNewFile,BufRead *.BUILD,BUILD,BUCK setf bzl 1413 endif 1414 1415 " BIND zone 1416 au BufNewFile,BufRead */named/db.*,*/bind/db.* call s:StarSetf('bindzone') 1417 1418 au BufNewFile,BufRead cabal.project.* call s:StarSetf('cabalproject') 1419 1420 " Calendar 1421 au BufNewFile,BufRead */.calendar/*, 1422 \*/share/calendar/*/calendar.*,*/share/calendar/calendar.* 1423 \ call s:StarSetf('calendar') 1424 1425 " Changelog 1426 au BufNewFile,BufRead [cC]hange[lL]og* 1427 \ if getline(1) =~ '; urgency=' 1428 \| call s:StarSetf('debchangelog') 1429 \|else 1430 \| call s:StarSetf('changelog') 1431 \|endif 1432 1433 " Crontab 1434 au BufNewFile,BufRead crontab,crontab.*,crontabs.*,*/etc/cron.d/* call s:StarSetf('crontab') 1435 1436 " dnsmasq(8) configuration 1437 au BufNewFile,BufRead */etc/dnsmasq.d/* call s:StarSetf('dnsmasq') 1438 1439 " Dockerfile 1440 au BufNewFile,BufRead Dockerfile.*,Containerfile.* call s:StarSetf('dockerfile') 1441 1442 " Dracula 1443 au BufNewFile,BufRead drac.* call s:StarSetf('dracula') 1444 1445 " Execline (s6) scripts 1446 au BufNewFile,BufRead s6-* call s:StarSetf('execline') 1447 1448 " Env 1449 au BufNewFile,BufRead *.env,.env{.*,} setf env 1450 1451 " Fvwm 1452 au BufNewFile,BufRead */.fvwm/* call s:StarSetf('fvwm') 1453 au BufNewFile,BufRead *fvwmrc*,*fvwm95*.hook 1454 \ let b:fvwm_version = 1 | call s:StarSetf('fvwm') 1455 au BufNewFile,BufRead *fvwm2rc* 1456 \ let b:fvwm_version = 2 | call s:StarSetf('fvwm') 1457 1458 " Gedcom 1459 au BufNewFile,BufRead */tmp/lltmp* call s:StarSetf('gedcom') 1460 1461 " Git 1462 au BufNewFile,BufRead */.gitconfig.d/*,*/etc/gitconfig.d/* call s:StarSetf('gitconfig') 1463 1464 " Gitolite 1465 au BufNewFile,BufRead */gitolite-admin/conf/* call s:StarSetf('gitolite') 1466 1467 " GTK RC 1468 au BufNewFile,BufRead .gtkrc*,gtkrc* call s:StarSetf('gtkrc') 1469 1470 " Jam 1471 au BufNewFile,BufRead Prl*.*,JAM*.* call s:StarSetf('jam') 1472 1473 " Jargon 1474 au! BufNewFile,BufRead *jarg* 1475 \ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'THIS IS THE JARGON FILE' 1476 \| call s:StarSetf('jargon') 1477 \|endif 1478 1479 " Java Properties resource file (note: doesn't catch font.properties.pl) 1480 au BufNewFile,BufRead *.properties_??_??_* call s:StarSetf('jproperties') 1481 1482 " Kconfig 1483 au BufNewFile,BufRead Kconfig.*,Config.in.* call s:StarSetf('kconfig') 1484 1485 " Lilo: Linux loader 1486 au BufNewFile,BufRead lilo.conf* call s:StarSetf('lilo') 1487 1488 " Libsensors 1489 au BufNewFile,BufRead */etc/sensors.d/[^.]* call s:StarSetf('sensors') 1490 1491 " Logcheck 1492 au BufNewFile,BufRead */etc/logcheck/*.d*/* call s:StarSetf('logcheck') 1493 1494 " Makefile 1495 au BufNewFile,BufRead [mM]akefile* if expand('<afile>:t') !~ g:ft_ignore_pat | call dist#ft#FTmake() | endif 1496 1497 " Ruby Makefile 1498 au BufNewFile,BufRead [rR]akefile* call s:StarSetf('ruby') 1499 1500 " Mail (also matches muttrc.vim, so this is below the other checks) 1501 au BufNewFile,BufRead {neo,}mutt[[:alnum:]._-]\\\{6\} setf mail 1502 1503 au BufNewFile,BufRead reportbug-* call s:StarSetf('mail') 1504 1505 " Messages (logs mostly) 1506 au BufNewFile,BufRead */log/{auth,cron,daemon,debug,kern,lpr,mail,messages,news/news,syslog,user}{,.log,.err,.info,.warn,.crit,.notice}{,.[0-9]*,-[0-9]*} 1507 \ call s:StarSetf('messages') 1508 1509 " Modconf 1510 au BufNewFile,BufRead */etc/modutils/* 1511 \ if executable(expand("<afile>")) != 1 1512 \| call s:StarSetf('modconf') 1513 \|endif 1514 au BufNewFile,BufRead */etc/modprobe.* call s:StarSetf('modconf') 1515 1516 " Mutt setup files (must be before catch *.rc) 1517 au BufNewFile,BufRead */etc/Muttrc.d/* call s:StarSetf('muttrc') 1518 1519 " Mutt setup file 1520 au BufNewFile,BufRead .mutt{ng,}rc*,*/.mutt{ng,}/mutt{ng,}rc* call s:StarSetf('muttrc') 1521 au BufNewFile,BufRead mutt{ng,}rc*,Mutt{ng,}rc* call s:StarSetf('muttrc') 1522 1523 " Neomutt setup file 1524 au BufNewFile,BufRead .neomuttrc*,*/.neomutt/neomuttrc* call s:StarSetf('neomuttrc') 1525 au BufNewFile,BufRead neomuttrc*,Neomuttrc* call s:StarSetf('neomuttrc') 1526 1527 " Nginx 1528 au BufNewFile,BufRead */etc/nginx/*,*/usr/local/nginx/conf/* call s:StarSetf('nginx') 1529 1530 " Nroff macros 1531 au BufNewFile,BufRead tmac.* call s:StarSetf('nroff') 1532 1533 " OpenBSD hostname.if 1534 au BufNewFile,BufRead */etc/hostname.* call s:StarSetf('config') 1535 1536 " OpenFOAM 1537 au BufNewFile,BufRead [a-zA-Z0-9]*Dict{,.*},[a-zA-Z]*Properties{,.*},*Transport.*,*/0{,.orig}/* 1538 \ if expand("<amatch>") !~ g:ft_ignore_pat 1539 \| call dist#ft#FTfoam() 1540 \|endif 1541 1542 " Pam conf 1543 au BufNewFile,BufRead */etc/pam.d/* call s:StarSetf('pamconf') 1544 1545 " Pandoc 1546 au BufNewFile,BufRead,BufFilePost *.pandoc,*.pdk,*.pd,*.pdc setf pandoc 1547 1548 " PHP config 1549 au BufNewFile,BufRead php.ini-*,php-fpm.conf*,www.conf* call s:StarSetf('dosini') 1550 1551 " Printcap and Termcap 1552 au BufNewFile,BufRead *printcap* 1553 \ if !did_filetype() 1554 \| let b:ptcap_type = "print" | call s:StarSetf('ptcap') 1555 \|endif 1556 au BufNewFile,BufRead *termcap* 1557 \ if !did_filetype() 1558 \| let b:ptcap_type = "term" | call s:StarSetf('ptcap') 1559 \|endif 1560 1561 " ReDIF 1562 " Only used when the .rdf file was not detected to be XML. 1563 au BufNewFile,BufRead *.rdf call dist#ft#Redif() 1564 1565 " Remind 1566 au BufNewFile,BufRead .reminders* call s:StarSetf('remind') 1567 1568 " SGML catalog file 1569 au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog') 1570 1571 " avoid doc files being recognized a shell files 1572 au BufNewFile,BufRead */doc/{,.}bash[_-]completion{,.d,.sh}{,/*} setf text 1573 1574 " Shell scripts ending in a star 1575 au BufNewFile,BufRead .bashrc*,.bash[_-]profile*,.bash[_-]logout*,.bash[_-]aliases*,bash-fc[-.]*,PKGBUILD*,APKBUILD*,*/{,.}bash[_-]completion{,.d,.sh}{,/*} call dist#ft#SetFileTypeSH("bash") 1576 au BufNewFile,BufRead .kshrc* call dist#ft#SetFileTypeSH("ksh") 1577 au BufNewFile,BufRead .profile* call dist#ft#SetFileTypeSH(getline(1)) 1578 1579 " Sudoers 1580 au BufNewFile,BufRead */etc/sudoers.d/* call s:StarSetf('sudoers') 1581 1582 " tcsh scripts ending in a star 1583 au BufNewFile,BufRead .tcshrc* call dist#ft#SetFileTypeShell("tcsh") 1584 1585 " csh scripts ending in a star 1586 au BufNewFile,BufRead .login*,.cshrc* call dist#ft#CSH() 1587 1588 " Tiltfile 1589 au BufNewFile,BufRead Tiltfile.* call s:StarSetf('tiltfile') 1590 1591 " tmux configuration with arbitrary extension 1592 au BufNewFile,BufRead {.,}tmux*.conf* call s:StarSetf('tmux') 1593 1594 " UCI 1595 " UCI files are normally in /etc/config, but that might be mounted over sshfs or similar, so we match more loosely. 1596 " There was some concern[1] that this pattern would match too much, so now we check the file content as well. 1597 " [1]: https://github.com/vim/vim/pull/14385#discussion_r1558878741 1598 au BufNewFile,BufRead */etc/config/* if dist#ft#Detect_UCI_statements() | call s:StarSetf('uci') | endif 1599 1600 " VHDL 1601 au BufNewFile,BufRead *.vhdl_[0-9]* call s:StarSetf('vhdl') 1602 1603 " Vim script 1604 au BufNewFile,BufRead *vimrc* call s:StarSetf('vim') 1605 1606 " Subversion commit file 1607 au BufNewFile,BufRead svn-commit*.tmp setf svn 1608 1609 " Wireguard config 1610 au BufNewFile,BufRead */etc/wireguard/*.conf setf dosini 1611 1612 " X resources file 1613 au BufNewFile,BufRead Xresources*,*/app-defaults/*,*/Xresources/* call s:StarSetf('xdefaults') 1614 1615 " XFree86 config 1616 au BufNewFile,BufRead XF86Config-4* 1617 \ let b:xf86conf_xfree86_version = 4 | call s:StarSetf('xf86conf') 1618 au BufNewFile,BufRead XF86Config* 1619 \ if getline(1) =~ '\<XConfigurator\>' 1620 \| let b:xf86conf_xfree86_version = 3 1621 \|endif 1622 \|call s:StarSetf('xf86conf') 1623 1624 " XKB 1625 au BufNewFile,BufRead */{,.}xkb/{compat,geometry,keycodes,symbols,types}/* call s:StarSetf('xkb') 1626 1627 " X11 xmodmap 1628 au BufNewFile,BufRead *xmodmap* call s:StarSetf('xmodmap') 1629 1630 " Xinetd conf 1631 au BufNewFile,BufRead */etc/xinetd.d/* call s:StarSetf('xinetd') 1632 1633 " yum conf (close enough to dosini) 1634 au BufNewFile,BufRead */etc/yum.repos.d/* call s:StarSetf('dosini') 1635 1636 " Z-Shell script ending in a star 1637 au BufNewFile,BufRead .zsh*,.zlog*,.zcompdump* call s:StarSetf('zsh') 1638 au BufNewFile,BufRead zsh*,zlog* call s:StarSetf('zsh') 1639 1640 " Help files match *.txt but should have a last line that is a modeline. 1641 au BufNewFile,BufRead *.txt 1642 \ if getline('$') !~ 'vim:.*ft=help' 1643 \| setf text 1644 \| endif 1645 1646 " Ghostty configuration 1647 au BufNewFile,BufRead */ghostty/config setf ghostty 1648 au BufNewFile,BufRead */ghostty/themes/* call s:StarSetf('ghostty') 1649 au BufNewFile,BufRead */com.mitchellh.ghostty/config setf ghostty 1650 1651 1652 " Generic log file 1653 " Disabled cause it is too distracting 1654 " au BufNewFile,BufRead *.log,*_log,*.LOG,*_LOG setf log 1655 1656 " Use the filetype detect plugins. They may overrule any of the previously 1657 " detected filetypes. 1658 runtime! ftdetect/*.vim 1659 1660 " NOTE: The above command could have ended the filetypedetect autocmd group 1661 " and started another one. Let's make sure it has ended to get to a consistent 1662 " state. 1663 augroup END 1664 1665 " Generic configuration file. Use FALLBACK, it's just guessing! 1666 au filetypedetect BufNewFile,BufRead,StdinReadPost * 1667 \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat 1668 \ && (expand("<amatch>") =~# '\.conf$' 1669 \ || getline(1) =~ '^#' || getline(2) =~ '^#' 1670 \ || getline(3) =~ '^#' || getline(4) =~ '^#' 1671 \ || getline(5) =~ '^#') | 1672 \ setf FALLBACK conf | 1673 \ endif 1674 1675 " If the GUI is already running, may still need to install the Syntax menu. 1676 " Don't do it when the 'M' flag is included in 'guioptions'. 1677 if has("menu") && has("gui_running") 1678 \ && !exists("did_install_syntax_menu") && &guioptions !~# "M" 1679 source <sfile>:p:h/menu.vim 1680 endif 1681 1682 " Function called for testing all functions defined here. These are 1683 " script-local, thus need to be executed here. 1684 " Returns a string with error messages (hopefully empty). 1685 func TestFiletypeFuncs(testlist) 1686 let output = '' 1687 for f in a:testlist 1688 try 1689 exe f 1690 catch 1691 let output = output . "\n" . f . ": " . v:exception 1692 endtry 1693 endfor 1694 return output 1695 endfunc 1696 1697 " Restore 'cpoptions' 1698 let &cpo = s:cpo_save 1699 unlet s:cpo_save 1700 1701 " vim: ts=8