set nuautocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()"func SetTitle() call append(0,'#include <stdio.h>')call append(1,'#include <stdlib.h>')call append(2,'#include <iostream>')call append(3,'#include <math.h>')call append(4,'#include <vector>')call append(5,'#include <set>')call append(6,'#include <string.h>')call append(7,'#include <map>')call append(8,'#include <algorithm>')call append(9,'')call append(10,'using namespace std;')call append(11,'')call append(12,'int main()')call append(13,'{')call append(14,' return 0;')call append(15,'}')call append(9,'#define ll long long')call append(0,'**************************************************************************/')call append(0,'')call append(0," > Created Time: ".strftime("%c"))call append(0,'')call append(0,' > Author: Juxuny')call append(0,'')call append(0,'/*************************************************************************')endfuncmap <F5> :call CompileRun_OpencvProject()func! CompileRun_OpencvProject()exec "!rm ./%<"exec "w!"exec "!g++ % -lpthread `pkg-config --cflags opencv` -o ./%<"exec "! ./%<"endfuncmap <F9> :call CompileRunGpp()func! CompileRunGpp()exec "w!"exec "!g++ % -g -o ./%<"exec "! ./%<"endfuncset backspace=indent,eol,startset nocompatibleset bs=2set columns=80set background=darkset tabstop=8set wrapmargin=8set nobkset cindentset shiftwidth=8set rulerset noexpandtab" Vim support file to detect file types"" Maintainer:Bram Moolenaar <Bram@vim.org>" Last Change:2010 Jul 30" Listen very carefully, I will say this only onceif exists("did_load_filetypes") finishendiflet did_load_filetypes = 1" Line continuation is used here, remove 'C' from 'cpoptions'let s:cpo_save = &cposet cpo&vimaugroup filetypedetect" Ignored extensionsif exists("*fnameescape")au BufNewFile,BufRead ?\+.orig,?\+.bak,?\+.old,?\+.new,?\+.dpkg-dist,?\+.dpkg-old,?\+.rpmsave,?\+.rpmnew\ exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r"))au BufNewFile,BufRead *~\ let s:name = expand("<afile>") |\ let s:short = substitute(s:name, '\~$', '', '') |\ if s:name != s:short && s:short != "" |\ exe "doau filetypedetect BufRead " . fnameescape(s:short) |\ endif |\ unlet! s:name s:shortau BufNewFile,BufRead ?\+.in\ if expand("<afile>:t") != "configure.in" |\ exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r")) |\ endifelseif &verbose > 0 echomsg "Warning: some filetypes will not be recognized because this version of Vim does not have fnameescape()"endif" Pattern used to match file names which should not be inspected." Currently finds compressed files.if !exists("g:ft_ignore_pat") let g:ft_ignore_pat = '\.\(Z\|gz\|bz2\|zip\|tgz\)$'endif" Function used for patterns that end in a star: don't set the filetype if the" file name matches ft_ignore_pat.func! s:StarSetf(ft) if expand("<amatch>") !~ g:ft_ignore_pat exe 'setf ' . a:ft endifendfunc" Abaqus or Trasysau BufNewFile,BufRead *.inpcall s:Check_inp()func! s:Check_inp() if getline(1) =~ '^\*' setf abaqus else let n = 1 if line("$") > 500 let nmax = 500 else let nmax = line("$") endif while n <= nmax if getline(n) =~? "^header surface data"setf trasysbreak endif let n = n + 1 endwhile endifendfunc" A-A-P recipeau BufNewFile,BufRead *.aapsetf aap" A2ps printing utilityau BufNewFile,BufRead etc/a2ps.cfg,etc/a2ps/*.cfg,a2psrc,.a2psrc setf a2ps" ABAB/4au BufNewFile,BufRead *.abapsetf abap" ABC music notationau BufNewFile,BufRead *.abcsetf abc" ABELau BufNewFile,BufRead *.ablsetf abel" AceDBau BufNewFile,BufRead *.wrmsetf acedb" Ada (83, 9X, 95)au BufNewFile,BufRead *.adb,*.ads,*.adasetf adaif has("vms") au BufNewFile,BufRead *.gpr,*.ada_m,*.adcsetf adaelse au BufNewFile,BufRead *.gprsetf adaendif" AHDLau BufNewFile,BufRead *.tdfsetf ahdl" AMPLau BufNewFile,BufRead *.runsetf ampl" Antau BufNewFile,BufRead build.xmlsetf ant" Apache style config fileau BufNewFile,BufRead proftpd.conf*call s:StarSetf('apachestyle')" Apache config fileau BufNewFile,BufRead .htaccess,/etc/httpd/*.conf setf apacheau BufNewFile,BufRead httpd.conf*,srm.conf*,access.conf*,apache.conf*,apache2.conf*,/etc/apache2/*.conf*,/etc/httpd/conf.d/*.conf* call s:StarSetf('apache')" XA65 MOS6510 cross assemblerau BufNewFile,BufRead *.a65setf a65" Applescriptau BufNewFile,BufRead *.scptsetf applescript" Applix ELFau BufNewFile,BufRead *.am\ if expand("<afile>") !~? 'Makefile.am\>' | setf elf | endif" ALSA configurationau BufNewFile,BufRead ~/.asoundrc,/usr/share/alsa/alsa.conf,/etc/asound.confsetf alsaconf" Arc Macro Languageau BufNewFile,BufRead *.amlsetf aml" Arch Inventory fileau BufNewFile,BufRead .arch-inventory,=tagging-methodsetf arch" ART*Enterprise (formerly ART-IM)au BufNewFile,BufRead *.artsetf art" ASN.1au BufNewFile,BufRead *.asn,*.asn1setf asn" Active Server Pages (with Visual Basic Script)au BufNewFile,BufRead *.asa\ if exists("g:filetype_asa") |\ exe "setf " . g:filetype_asa |\ else |\ setf aspvbs |\ endif" Active Server Pages (with Perl or Visual Basic Script)au BufNewFile,BufRead *.asp\ if exists("g:filetype_asp") |\ exe "setf " . g:filetype_asp |\ elseif getline(1) . getline(2) . getline(3) =~? "perlscript" |\ setf aspperl |\ else |\ setf aspvbs |\ endif" Grub (must be before catch *.lst)au BufNewFile,BufRead /boot/grub/menu.lst,/boot/grub/grub.conf,/etc/grub.confsetf grub" Assembly (all kinds)" *.lst is not pure assembly, it has two extra columns (address, byte codes)au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.mac,*.lstcall s:FTasm()" This function checks for the kind of assembly that is wanted by the user, or" can be detected from the first five lines of the file.func! s:FTasm() " make sure b:asmsyntax exists if !exists("b:asmsyntax") let b:asmsyntax = "" endif if b:asmsyntax == "" call s:FTasmsyntax() endif " if b:asmsyntax still isn't set, default to asmsyntax or GNU if b:asmsyntax == "" if exists("g:asmsyntax") let b:asmsyntax = g:asmsyntax else let b:asmsyntax = "asm" endif endif exe "setf " . fnameescape(b:asmsyntax)endfuncfunc! s:FTasmsyntax() " see if file contains any asmsyntax=foo overrides. If so, change " b:asmsyntax appropriately let head = " ".getline(1)." ".getline(2)." ".getline(3)." ".getline(4).\" ".getline(5)." " let match = matchstr(head, '\sasmsyntax=\zs[a-zA-Z0-9]\+\ze\s') if match != '' let b:asmsyntax = match elseif ((head =~? '\.title') || (head =~? '\.ident') || (head =~? '\.macro') || (head =~? '\.subtitle') || (head =~? '\.library')) let b:asmsyntax = "vmasm" endifendfunc" Macro (VAX)au BufNewFile,BufRead *.marsetf vmasm" Atlasau BufNewFile,BufRead *.atl,*.assetf atlas" Autoit v3au BufNewFile,BufRead *.au3setf autoit" Autohotkeyau BufNewFile,BufRead *.ahksetf autohotkey" Automakeau BufNewFile,BufRead [mM]akefile.am,GNUmakefile.amsetf automake" Autotest .at files are actually m4au BufNewFile,BufRead *.atsetf m4" Avenueau BufNewFile,BufRead *.avesetf ave" Awkau BufNewFile,BufRead *.awksetf awk" Bau BufNewFile,BufRead *.mch,*.ref,*.impsetf b" BASIC or Visual Basicau BufNewFile,BufRead *.bascall s:FTVB("basic")" Check if one of the first five lines contains "VB_Name". In that case it is" probably a Visual Basic file. Otherwise it's assumed to be "alt" filetype.func! s:FTVB(alt) if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)' setf vb else exe "setf " . a:alt endifendfunc" Visual Basic Script (close to Visual Basic)au BufNewFile,BufRead *.vbs,*.dsm,*.ctlsetf vb" IBasic file (similar to QBasic)au BufNewFile,BufRead *.iba,*.ibisetf ibasic" FreeBasic file (similar to QBasic)au BufNewFile,BufRead *.fb,*.bisetf freebasic" Batch file for MSDOS.au BufNewFile,BufRead *.bat,*.syssetf dosbatch" *.cmd is close to a Batch file, but on OS/2 Rexx files also use *.cmd.au BufNewFile,BufRead *.cmd\ if getline(1) =~ '^/\*' | setf rexx | else | setf dosbatch | endif" Batch file for 4DOSau BufNewFile,BufRead *.btmcall s:FTbtm()func! s:FTbtm() if exists("g:dosbatch_syntax_for_btm") && g:dosbatch_syntax_for_btm setf dosbatch else setf btm endifendfunc" BC calculatorau BufNewFile,BufRead *.bcsetf bc" BDF fontau BufNewFile,BufRead *.bdfsetf bdf" BibTeX bibliography database fileau BufNewFile,BufRead *.bibsetf bib" BibTeX Bibliography Styleau BufNewFile,BufRead *.bstsetf bst" BIND configurationau BufNewFile,BufRead named.conf,rndc.confsetf named" BIND zoneau BufNewFile,BufRead named.rootsetf bindzoneau BufNewFile,BufRead *.dbcall s:BindzoneCheck('')func! s:BindzoneCheck(default) if getline(1).getline(2).getline(3).getline(4) =~ '^; <<>> DiG [0-9.]\+ <<>>\|BIND.*named\|$ORIGIN\|$TTL\|IN\s\+SOA' setf bindzone elseif a:default != '' exe 'setf ' . a:default endifendfunc" Blankau BufNewFile,BufRead *.blsetf blank" Blkid cache fileau BufNewFile,BufRead /etc/blkid.tab,/etc/blkid.tab.old setf xml" C or lpcau BufNewFile,BufRead *.ccall s:FTlpc()func! s:FTlpc() if exists("g:lpc_syntax_for_c") let lnum = 1 while lnum <= 12 if getline(lnum) =~# '^\(//\|inherit\|private\|protected\|nosave\|string\|object\|mapping\|mixed\)'setf lpcreturn endif let lnum = lnum + 1 endwhile endif setf cendfunc" Calendarau BufNewFile,BufRead calendarsetf calendarau BufNewFile,BufRead */.calendar/*,\*/share/calendar/*/calendar.*,*/share/calendar/calendar.*\call s:StarSetf('calendar')" C#au BufNewFile,BufRead *.cssetf cs" Cabalau BufNewFile,BufRead *.cabal setf cabal" Cdrdao TOCau BufNewFile,BufRead *.tocsetf cdrtoc" Cdrdao configau BufNewFile,BufRead etc/cdrdao.conf,etc/defaults/cdrdao,etc/default/cdrdao,~/.cdrdaosetf cdrdaoconf" Cfengineau BufNewFile,BufRead cfengine.confsetf cfengine" ChaiScriptau BufRead,BufNewFile *.chaisetf chaiscript" Comshare Dimension Definition Languageau BufNewFile,BufRead *.cdlsetf cdl" Conary Recipeau BufNewFile,BufRead *.recipesetf conaryrecipe" Controllable Regex Mutilatorau BufNewFile,BufRead *.crmsetf crm" Cyn++au BufNewFile,BufRead *.cynsetf cynpp" Cynlib" .cc and .cpp files can be C++ or Cynlib.au BufNewFile,BufRead *.cc\ if exists("cynlib_syntax_for_cc")|setf cynlib|else|setf cpp|endifau BufNewFile,BufRead *.cpp\ if exists("cynlib_syntax_for_cpp")|setf cynlib|else|setf cpp|endif" C++au BufNewFile,BufRead *.cxx,*.c++,*.hh,*.hxx,*.hpp,*.ipp,*.moc,*.tcc,*.inl setf cppif has("fname_case") au BufNewFile,BufRead *.C,*.H setf cppendif" .h files can be C, Ch C++, ObjC or ObjC++." Set c_syntax_for_h if you want C, ch_syntax_for_h if you want Ch. ObjC is" detected automatically.au BufNewFile,BufRead *.hcall s:FTheader()func! s:FTheader() if match(getline(1, min([line("$"), 200])), '^@\(interface\|end\|class\)') > -1 setf objc elseif exists("g:c_syntax_for_h") setf c elseif exists("g:ch_syntax_for_h") setf ch else setf cpp endifendfunc" Ch (CHscript)au BufNewFile,BufRead *.chfsetf ch" TLH files are C++ headers generated by Visual C++'s #import from typelibsau BufNewFile,BufRead *.tlhsetf cpp" Cascading Style Sheetsau BufNewFile,BufRead *.csssetf css" Century Term Command Scripts (*.cmd too)au BufNewFile,BufRead *.consetf cterm" Changelogau BufNewFile,BufRead changelog.Debian,changelog.dch,NEWS.Debian,NEWS.dch\setf debchangelogau BufNewFile,BufRead [cC]hange[lL]og\ if getline(1) =~ '; urgency='\| setf debchangelog\| else\| setf changelog\| endifau BufNewFile,BufRead NEWS\ if getline(1) =~ '; urgency='\| setf debchangelog\| endif" CHILLau BufNewFile,BufRead *..chsetf chill" Changes for WEB and CWEB or CHILLau BufNewFile,BufRead *.chcall s:FTchange()" This function checks if one of the first ten lines start with a '@'. In" that case it is probably a change file." If the first line starts with # or ! it's probably a ch file." If a line has "main", "include", "//" ir "/*" it's probably ch." Otherwise CHILL is assumed.func! s:FTchange() let lnum = 1 while lnum <= 10 if getline(lnum)[0] == '@' setf change return endif if lnum == 1 && (getline(1)[0] == '#' || getline(1)[0] == '!') setf ch return endif if getline(lnum) =~ "MODULE" setf chill return endif if getline(lnum) =~ 'main\s*(\|#\s*include\|//' setf ch return endif let lnum = lnum + 1 endwhile setf chillendfunc" ChordProau BufNewFile,BufRead *.chopro,*.crd,*.cho,*.crdpro,*.chordprosetf chordpro" Cleanau BufNewFile,BufRead *.dcl,*.iclsetf clean" Cleverau BufNewFile,BufRead *.enisetf cl" Clever or dtdau BufNewFile,BufRead *.entcall s:FTent()func! s:FTent() " This function checks for valid cl syntax in the first five lines. " Look for either an opening comment, '#', or a block start, '{". " If not found, assume SGML. let lnum = 1 while lnum < 6 let line = getline(lnum) if line =~ '^\s*[#{]' setf cl return elseif line !~ '^\s*$' " Not a blank line, not a comment, and not a block start, " so doesn't look like valid cl code. break endif let lnum = lnum + 1 endw setf dtdendfunc" Clipper (or FoxPro; could also be eviews)au BufNewFile,BufRead *.prg\ if exists("g:filetype_prg") |\ exe "setf " . g:filetype_prg |\ else |\ setf clipper |\ endif" Cmakeau BufNewFile,BufRead CMakeLists.txt,*.cmake,*.cmake.insetf cmake" Cmusrcau BufNewFile,BufRead ~/.cmus/{autosave,rc,command-history,*.theme} setf cmusrcau BufNewFile,BufRead */cmus/{rc,*.theme}setf cmusrc" Cobolau BufNewFile,BufRead *.cbl,*.cob,*.libsetf cobol" cobol or zope form controller python script? (heuristic)au BufNewFile,BufRead *.cpy\ if getline(1) =~ '^##' |\ setf python |\ else |\ setf cobol |\ endif" Coco/Rau BufNewFile,BufRead *.atgsetf coco" Cold Fusionau BufNewFile,BufRead *.cfm,*.cfi,*.cfcsetf cf" Configure scriptsau BufNewFile,BufRead configure.in,configure.ac setf config" CUDA Cumpute Unified Device Architectureau BufNewFile,BufRead *.cusetf cuda" WildPackets EtherPeek Decoderau BufNewFile,BufRead *.dcdsetf dcd" Enlightenment configuration filesau BufNewFile,BufRead *enlightenment/*.cfgsetf c" Etermau BufNewFile,BufRead *Eterm/*.cfgsetf eterm" Lynx config filesau BufNewFile,BufRead lynx.cfgsetf lynx" Quakeau BufNewFile,BufRead *baseq[2-3]/*.cfg,*id1/*.cfgsetf quakeau BufNewFile,BufRead *quake[1-3]/*.cfgsetf quake" Quake Cau BufNewFile,BufRead *.qcsetf c" Configure filesau BufNewFile,BufRead *.cfgsetf cfg" Cucumberau BufNewFile,BufRead *.feature setf cucumber" Communicating Sequential Processesau BufNewFile,BufRead *.csp,*.fdrsetf csp" CUPL logic description and simulationau BufNewFile,BufRead *.pldsetf cuplau BufNewFile,BufRead *.sisetf cuplsim" Debian Controlau BufNewFile,BufRead */debian/controlsetf debcontrolau BufNewFile,BufRead control\ if getline(1) =~ '^Source:'\| setf debcontrol\| endif" Debian Sources.listau BufNewFile,BufRead /etc/apt/sources.listsetf debsources" Deny hostsau BufNewFile,BufRead denyhosts.confsetf denyhosts" ROCKLinux package descriptionau BufNewFile,BufRead *.descsetf desc" the D language or dtraceau BufNewFile,BufRead *.dcall s:DtraceCheck()func! s:DtraceCheck() let lines = getline(1, min([line("$"), 100])) if match(lines, '^#!\S\+dtrace\|#pragma\s\+D\s\+option\|:\S\{-}:\S\{-}:') > -1 setf dtrace else setf d endifendfunc" Desktop filesau BufNewFile,BufRead *.desktop,.directorysetf desktop" Dict configau BufNewFile,BufRead dict.conf,.dictrcsetf dictconf" Dictd configau BufNewFile,BufRead dictd.confsetf dictdconf" Diff filesau BufNewFile,BufRead *.diff,*.rej,*.patchsetf diff" Dircolorsau BufNewFile,BufRead .dir_colors,/etc/DIR_COLORSsetf dircolors" Diva (with Skill) or InstallShieldau BufNewFile,BufRead *.rul\ if getline(1).getline(2).getline(3).getline(4).getline(5).getline(6) =~? 'InstallShield' |\ setf ishd |\ else |\ setf diva |\ endif" DCL (Digital Command Language - vms) or DNS zone fileau BufNewFile,BufRead *.comcall s:BindzoneCheck('dcl')" DOTau BufNewFile,BufRead *.dotsetf dot" Dylan - lid filesau BufNewFile,BufRead *.lidsetf dylanlid" Dylan - intr files (melange)au BufNewFile,BufRead *.intrsetf dylanintr" Dylanau BufNewFile,BufRead *.dylansetf dylan" Microsoft Module Definitionau BufNewFile,BufRead *.defsetf def" Draculaau BufNewFile,BufRead *.drac,*.drc,*lvs,*lpesetf dracula" Datascriptau BufNewFile,BufRead *.dssetf datascript" dslau BufNewFile,BufRead *.dslsetf dsl" DTD (Document Type Definition for XML)au BufNewFile,BufRead *.dtdsetf dtd" EDIF (*.edf,*.edif,*.edn,*.edo)au BufNewFile,BufRead *.ed\(f\|if\|n\|o\)setf edif" Embedix Component Descriptionau BufNewFile,BufRead *.ecdsetf ecd" Eiffel or Specmanau BufNewFile,BufRead *.e,*.Ecall s:FTe()" Elinks configurationau BufNewFile,BufRead */etc/elinks.conf,*/.elinks/elinks.confsetf elinksfunc! s:FTe() let n = 1 while n < 100 && n < line("$") if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$" setf specman return endif let n = n + 1 endwhile setf eiffelendfunc" ERicsson LANGuage; Yaws is erlang tooau BufNewFile,BufRead *.erl,*.hrl,*.yawssetf erlang" Elm Filter Rules fileau BufNewFile,BufRead filter-rulessetf elmfilt" ESMTP rc fileau BufNewFile,BufRead *esmtprcsetf esmtprc" ESQL-Cau BufNewFile,BufRead *.ec,*.ECsetf esqlc" Esterelau BufNewFile,BufRead *.strlsetf esterel" Essbase scriptau BufNewFile,BufRead *.cscsetf csc" Eximau BufNewFile,BufRead exim.confsetf exim" Expectau BufNewFile,BufRead *.expsetf expect" Exportsau BufNewFile,BufRead exportssetf exports" Fantomau BufNewFile,BufRead *.fan,*.fwtsetf fan" Factorau BufNewFile,BufRead *.factorsetf factor" Fetchmail RC fileau BufNewFile,BufRead .fetchmailrcsetf fetchmail" FlexWiki - disabled, because it has side effects when a .wiki file" is not actually FlexWiki"au BufNewFile,BufRead *.wikisetf flexwiki" Focus Executableau BufNewFile,BufRead *.fex,*.focexecsetf focexec" Focus Master file (but not for auto.master)au BufNewFile,BufRead auto.mastersetf confau BufNewFile,BufRead *.mas,*.mastersetf master" Forthau BufNewFile,BufRead *.fs,*.ftsetf forth" Reva Forthau BufNewFile,BufRead *.frtsetf reva" Fortranif has("fname_case") au BufNewFile,BufRead *.F,*.FOR,*.FPP,*.FTN,*.F77,*.F90,*.F95,*.F03,*.F08 setf fortranendifau BufNewFile,BufRead *.f,*.for,*.fortran,*.fpp,*.ftn,*.f77,*.f90,*.f95,*.f03,*.f08 setf fortran" Framescriptau BufNewFile,BufRead *.fslsetf framescript" FStabau BufNewFile,BufRead fstab,mtabsetf fstab" GDB command filesau BufNewFile,BufRead .gdbinitsetf gdb" GDMOau BufNewFile,BufRead *.mo,*.gdmosetf gdmo" Gedcomau BufNewFile,BufRead *.ged,lltxxxxx.txtsetf gedcom" Gitautocmd BufNewFile,BufRead *.git/COMMIT_EDITMSG setf gitcommitautocmd BufNewFile,BufRead *.git/config,.gitconfig,.gitmodules setf gitconfigautocmd BufNewFile,BufRead git-rebase-todo setf gitrebaseautocmd BufNewFile,BufRead .msg.[0-9]* \ if getline(1) =~ '^From.*# This line is ignored.$' | \ setf gitsendemail | \ endifautocmd BufNewFile,BufRead *.git/** \ if getline(1) =~ '^\x\{40\}\>\|^ref: ' | \ setf git | \ endif" Gkrellmrcau BufNewFile,BufRead gkrellmrc,gkrellmrc_?setf gkrellmrc" GP scripts (2.0 and onward)au BufNewFile,BufRead *.gp,.gprcsetf gp" GPGau BufNewFile,BufRead */.gnupg/optionssetf gpgau BufNewFile,BufRead */.gnupg/gpg.confsetf gpgau BufNewFile,BufRead /usr/**/gnupg/options.skel setf gpg" Gnuplot scriptsau BufNewFile,BufRead *.gpisetf gnuplot" GrADS scriptsau BufNewFile,BufRead *.gssetf grads" Gretlau BufNewFile,BufRead *.gretlsetf gretl" Groovyau BufNewFile,BufRead *.groovysetf groovy" GNU Server Pagesau BufNewFile,BufRead *.gspsetf gsp" Group fileau 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" GTK RCau BufNewFile,BufRead .gtkrc,gtkrcsetf gtkrc" Hamlau BufNewFile,BufRead *.hamlsetf haml" Hamster Classic | Playground filesau BufNewFile,BufRead *.hsc,*.hsmsetf hamster" Haskellau BufNewFile,BufRead *.hs,*.hs-boot setf haskellau BufNewFile,BufRead *.lhssetf lhaskellau BufNewFile,BufRead *.chssetf chaskell" Hasteau BufNewFile,BufRead *.htsetf hasteau BufNewFile,BufRead *.htppsetf hastepreproc" Herculesau BufNewFile,BufRead *.vc,*.ev,*.rs,*.sum,*.errsumsetf hercules" HEX (Intel)au BufNewFile,BufRead *.hex,*.h32setf hex" Tilde (must be before HTML)au BufNewFile,BufRead *.t.htmlsetf tilde" HTML (.shtml and .stm for server side)au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm call s:FThtml()" Distinguish between HTML, XHTML and Djangofunc! s:FThtml() let n = 1 while n < 10 && n < line("$") if getline(n) =~ '\<DTD\s\+XHTML\s' setf xhtml return endif if getline(n) =~ '{%\s*\(extends\|block\)\>' setf htmldjango return endif let n = n + 1 endwhile setf htmlendfunc" HTML with Ruby - eRubyau BufNewFile,BufRead *.erb,*.rhtmlsetf eruby" HTML with M4au BufNewFile,BufRead *.html.m4setf htmlm4" HTML Cheetah templateau BufNewFile,BufRead *.tmplsetf htmlcheetah" Host configau BufNewFile,BufRead /etc/host.confsetf hostconf" Hosts accessau BufNewFile,BufRead /etc/hosts.allow,/etc/hosts.deny setf hostsaccess" Hyper Builderau BufNewFile,BufRead *.hbsetf hb" Iconau BufNewFile,BufRead *.icnsetf icon" IDL (Interface Description Language)au BufNewFile,BufRead *.idlcall s:FTidl()" Distinguish between standard IDL and MS-IDLfunc! s:FTidl() let n = 1 while n < 50 && n < line("$") if getline(n) =~ '^\s*import\s\+"\(unknwn\|objidl\)\.idl"' setf msidl return endif let n = n + 1 endwhile setf idlendfunc" Microsoft IDL (Interface Description Language) Also *.idl" MOF = WMI (Windows Management Instrumentation) Managed Object Formatau BufNewFile,BufRead *.odl,*.mofsetf msidl" Icewm menuau BufNewFile,BufRead */.icewm/menusetf icemenu" Indent profile (must come before IDL *.pro!)au BufNewFile,BufRead .indent.prosetf indentau BufNewFile,BufRead indent.procall s:ProtoCheck('indent')" IDL (Interactive Data Language)au BufNewFile,BufRead *.procall s:ProtoCheck('idlang')" Distinguish between "default" and Cproto prototype file. */func! s:ProtoCheck(default) " Cproto files have a comment in the first line and a function prototype in " the second line, it always ends in ";". Indent files may also have " comments, thus we can't match comments to see the difference. if getline(2) =~ ';$' setf cpp else exe 'setf ' . a:default endifendfunc" Indent RCau BufNewFile,BufRead indentrcsetf indent" Informau BufNewFile,BufRead *.inf,*.INFsetf inform" Initngau BufNewFile,BufRead /etc/initng/**/*.i,*.iisetf initng" Ipfilterau BufNewFile,BufRead ipf.conf,ipf6.conf,ipf.rulessetf ipfilter" Informix 4GL (source - canonical, include file, I4GL+M4 preproc.)au BufNewFile,BufRead *.4gl,*.4gh,*.m4glsetf fgl" .INI file for MSDOSau BufNewFile,BufRead *.inisetf dosini" SysV Inittabau BufNewFile,BufRead inittabsetf inittab" Inno Setupau BufNewFile,BufRead *.isssetf iss" JALau BufNewFile,BufRead *.jal,*.JALsetf jal" Jamau BufNewFile,BufRead *.jpl,*.jprsetf jam" Javaau BufNewFile,BufRead *.java,*.javsetf java" JavaCCau BufNewFile,BufRead *.jj,*.jjtsetf javacc" JavaScript, ECMAScriptau BufNewFile,BufRead *.js,*.javascript,*.es,*.jsxsetf javascript" Java Server Pagesau BufNewFile,BufRead *.jspsetf jsp" Java Properties resource file (note: doesn't catch font.properties.pl)au BufNewFile,BufRead *.properties,*.properties_??,*.properties_??_??setf jpropertiesau BufNewFile,BufRead *.properties_??_??_*call s:StarSetf('jproperties')" Jessau BufNewFile,BufRead *.clpsetf jess" Jgraphau BufNewFile,BufRead *.jgrsetf jgraph" Kixtartau BufNewFile,BufRead *.kixsetf kix" Kimwitu[++]au BufNewFile,BufRead *.ksetf kwt" KDE scriptau BufNewFile,BufRead *.kssetf kscript" Kconfigau BufNewFile,BufRead Kconfig,Kconfig.debugsetf kconfig" Lace (ISE)au BufNewFile,BufRead *.ace,*.ACEsetf lace" Latteau BufNewFile,BufRead *.latte,*.ltesetf latte" Limitsau BufNewFile,BufRead /etc/limitssetf limits" LambdaProlog (*.mod too, see Modsim)au BufNewFile,BufRead *.sigsetf lprolog" LDAP LDIFau BufNewFile,BufRead *.ldifsetf ldif" Ld loaderau BufNewFile,BufRead *.ldsetf ld" Lexau BufNewFile,BufRead *.lex,*.lsetf lex" Libaoau BufNewFile,BufRead /etc/libao.conf,*/.libaosetf libao" Libsensorsau BufNewFile,BufRead /etc/sensors.confsetf sensors" LFTPau BufNewFile,BufRead lftp.conf,.lftprc,*lftp/rcsetf lftp" Lifelines (or Lex for C++!)au BufNewFile,BufRead *.llsetf lifelines" Lilo: Linux loaderau BufNewFile,BufRead lilo.conf*call s:StarSetf('lilo')" Lisp (*.el = ELisp, *.cl = Common Lisp, *.jl = librep Lisp)if has("fname_case") au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,*.L,.emacs,.sawfishrc setf lispelse au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,.emacs,.sawfishrc setf lispendif" SBCL implementation of Common Lispau BufNewFile,BufRead sbclrc,.sbclrcsetf lisp" Liquidau BufNewFile,BufRead *.liquidsetf liquid" Liteau BufNewFile,BufRead *.lite,*.ltsetf lite" LiteStep RC filesau BufNewFile,BufRead */LiteStep/*/*.rcsetf litestep" Login accessau BufNewFile,BufRead /etc/login.accesssetf loginaccess" Login defsau BufNewFile,BufRead /etc/login.defssetf logindefs" Logtalkau BufNewFile,BufRead *.lgtsetf logtalk" LOTOSau BufNewFile,BufRead *.lot,*.lotossetf lotos" Lout (also: *.lt)au BufNewFile,BufRead *.lou,*.loutsetf lout" Luaau BufNewFile,BufRead *.luasetf lua" Linden Scripting Language (Second Life)au BufNewFile,BufRead *.lslsetf lsl" Lynx style file (or LotusScript!)au BufNewFile,BufRead *.lsssetf lss" M4au BufNewFile,BufRead *.m4\ if expand("<afile>") !~? 'html.m4$\|fvwm2rc' | setf m4 | endif" MaGic Pointau BufNewFile,BufRead *.mgpsetf mgp" Mail (for Elm, trn, mutt, muttng, rn, slrn)au BufNewFile,BufRead snd.\d\+,.letter,.letter.\d\+,.followup,.article,.article.\d\+,pico.\d\+,mutt{ng,}-*-\w\+,mutt[[:alnum:]_-]\{6\},ae\d\+.txt,/tmp/SLRN[0-9A-Z.]\+,*.eml setf mail" Mail aliasesau BufNewFile,BufRead /etc/mail/aliases,/etc/aliasessetf mailaliases" Mailcap configuration fileau BufNewFile,BufRead .mailcap,mailcapsetf mailcap" Makefileau BufNewFile,BufRead *[mM]akefile,*.mk,*.mak,*.dsp setf make" MakeIndexau BufNewFile,BufRead *.ist,*.mstsetf ist" Manpageau BufNewFile,BufRead *.mansetf man" Man configau BufNewFile,BufRead /etc/man.conf,man.configsetf manconf" Maple Vau BufNewFile,BufRead *.mv,*.mpl,*.mwssetf maple" Map (UMN mapserver config file)au BufNewFile,BufRead *.mapsetf map" Markdownau BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,README.md setf markdown" Masonau BufNewFile,BufRead *.mason,*.mhtmlsetf mason" Matlab or Objective Cau BufNewFile,BufRead *.mcall s:FTm()func! s:FTm() let n = 1 while n < 10 let line = getline(n) if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\|//\)' setf objc return endif if line =~ '^\s*%' setf matlab return endif if line =~ '^\s*(\*' setf mma return endif let n = n + 1 endwhile if exists("g:filetype_m") exe "setf " . g:filetype_m else setf matlab endifendfunc" Mathematica notebookau BufNewFile,BufRead *.nbsetf mma" Maya Extension Languageau BufNewFile,BufRead *.melsetf mel" Mercurial config (looks like generic config file)au BufNewFile,BufRead *.hgrc,*hgrcsetf cfg" Messagesau BufNewFile,BufRead /var/log/messages,/var/log/messages.*[0-9] setf messages" Metafontau BufNewFile,BufRead *.mfsetf mf" MetaPostau BufNewFile,BufRead *.mpsetf mp" MGLau BufNewFile,BufRead *.mglsetf mgl" MMIX or VMS makefileau BufNewFile,BufRead *.mmscall s:FTmms()" Symbian meta-makefile definition (MMP)au BufNewFile,BufRead *.mmpsetf mmpfunc! s:FTmms() let n = 1 while n < 10 let line = getline(n) if line =~ '^\s*\(%\|//\)' || line =~ '^\*' setf mmix return endif if line =~ '^\s*#' setf make return endif let n = n + 1 endwhile setf mmixendfunc" Modsim III (or LambdaProlog)au BufNewFile,BufRead *.mod\ if getline(1) =~ '\<module\>' |\ setf lprolog |\ else |\ setf modsim3 |\ endif" Modula 2au BufNewFile,BufRead *.m2,*.DEF,*.MOD,*.md,*.mi setf modula2" Modula 3 (.m3, .i3, .mg, .ig)au BufNewFile,BufRead *.[mi][3g]setf modula3" Monkau BufNewFile,BufRead *.isc,*.monk,*.ssc,*.tscsetf monk" MOOau BufNewFile,BufRead *.moosetf moo" Modconfau BufNewFile,BufRead /etc/modules.conf,/etc/conf.modulessetf modconfau BufNewFile,BufRead /etc/modutils/*\ if executable(expand("<afile>")) != 1\| call s:StarSetf('modconf')\|endif" Mplayer configau BufNewFile,BufRead mplayer.conf,*/.mplayer/configsetf mplayerconf" Moterola S recordau BufNewFile,BufRead *.s19,*.s28,*.s37setf srec" Mrxvtrcau BufNewFile,BufRead mrxvtrc,.mrxvtrcsetf mrxvtrc" Msqlau BufNewFile,BufRead *.msqlsetf msql" Mysqlau BufNewFile,BufRead *.mysqlsetf mysql" M$ Resource filesau BufNewFile,BufRead *.rcsetf rc" MuPAD sourceau BufRead,BufNewFile *.musetf mupad" Mushau BufNewFile,BufRead *.mushsetf mush" Mutt setup file (also for Muttng)au BufNewFile,BufRead Mutt{ng,}rcsetf muttrc" Nanoau BufNewFile,BufRead /etc/nanorc,.nanorcsetf nanorc" Nastran input/DMAP"au BufNewFile,BufRead *.datsetf nastran" Naturalau BufNewFile,BufRead *.NS[ACGLMNPS]setf natural" Netrcau BufNewFile,BufRead .netrcsetf netrc" Novell netware batch filesau BufNewFile,BufRead *.ncfsetf ncf" Nroff/Troff (*.ms and *.t are checked below)au BufNewFile,BufRead *.me\ if expand("<afile>") != "read.me" && expand("<afile>") != "click.me" |\ setf nroff |\ endifau BufNewFile,BufRead *.tr,*.nr,*.roff,*.tmac,*.momsetf nroffau BufNewFile,BufRead *.[1-9]call s:FTnroff()" This function checks if one of the first five lines start with a dot. In" that case it is probably an nroff file: 'filetype' is set and 1 is returned.func! s:FTnroff() if getline(1)[0] . getline(2)[0] . getline(3)[0] . getline(4)[0] . getline(5)[0] =~ '\.' setf nroff return 1 endif return 0endfunc" Nroff or Objective C++au BufNewFile,BufRead *.mmcall s:FTmm()func! s:FTmm() let n = 1 while n < 10 let line = getline(n) if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)' setf objcpp return endif let n = n + 1 endwhile setf nroffendfunc" Not Quite Cau BufNewFile,BufRead *.nqcsetf nqc" NSISau BufNewFile,BufRead *.nsisetf nsis" OCAMLau BufNewFile,BufRead *.ml,*.mli,*.mll,*.mlysetf ocaml" Occamau BufNewFile,BufRead *.occsetf occam" Omnimarkau BufNewFile,BufRead *.xom,*.xinsetf omnimark" OpenROADau BufNewFile,BufRead *.orsetf openroad" OPLau BufNewFile,BufRead *.[Oo][Pp][Ll]setf opl" Oracle config fileau BufNewFile,BufRead *.orasetf ora" Packet filter confau BufNewFile,BufRead pf.confsetf pf" Pam confau BufNewFile,BufRead /etc/pam.confsetf pamconf" PAppau BufNewFile,BufRead *.papp,*.pxml,*.pxslsetf papp" Password fileau BufNewFile,BufRead /etc/passwd,/etc/passwd-,/etc/passwd.edit,/etc/shadow,/etc/shadow-,/var/backups/passwd.bak,/var/backups/shadow.bak setf passwd" Pascal (also *.p)au BufNewFile,BufRead *.passetf pascal" Delphi project fileau BufNewFile,BufRead *.dprsetf pascal" PDFau BufNewFile,BufRead *.pdfsetf pdf" Perlif has("fname_case") au BufNewFile,BufRead *.pl,*.PLcall s:FTpl()else au BufNewFile,BufRead *.plcall s:FTpl()endifau BufNewFile,BufRead *.plx,*.alsetf perlau BufNewFile,BufRead *.p6,*.pm6setf perl6func! s:FTpl() if exists("g:filetype_pl") exe "setf " . g:filetype_pl else " recognize Prolog by specific text in the first non-empty line " require a blank after the '%' because Perl uses "%list" and "%translate" let l = getline(nextnonblank(1)) if l =~ '\<prolog\>' || l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-' setf prolog else setf perl endif endifendfunc" Perl, XPM or XPM2au BufNewFile,BufRead *.pm\ if getline(1) =~ "XPM2" |\ setf xpm2 |\ elseif getline(1) =~ "XPM" |\ setf xpm |\ else |\ setf perl |\ endif" Perl PODau BufNewFile,BufRead *.podsetf pod" Php, php3, php4, etc." Also Phtml (was used for PHP 2 in the past)" Also .ctp for Cake template fileau BufNewFile,BufRead *.php,*.php\d,*.phtml,*.ctpsetf php" Pikeau BufNewFile,BufRead *.pike,*.lpc,*.ulpc,*.pmod setf pike" Pinfo configau BufNewFile,BufRead */etc/pinforc,*/.pinforcsetf pinfo" Palm Resource compilerau BufNewFile,BufRead *.rcpsetf pilrc" Pine configau BufNewFile,BufRead .pinerc,pinerc,.pinercex,pinercexsetf pine" PL/M (also: *.inp)au BufNewFile,BufRead *.plm,*.p36,*.pacsetf plm" PL/SQLau BufNewFile,BufRead *.pls,*.plsqlsetf plsql" PLPau BufNewFile,BufRead *.plpsetf plp" PO and PO template (GNU gettext)au BufNewFile,BufRead *.po,*.potsetf po" Postfix main configau BufNewFile,BufRead main.cfsetf pfmain" PostScript (+ font files, encapsulated PostScript, Adobe Illustrator)au BufNewFile,BufRead *.ps,*.pfa,*.afm,*.eps,*.epsf,*.epsi,*.ai setf postscr" PostScript Printer Descriptionau BufNewFile,BufRead *.ppdsetf ppd" Povrayau BufNewFile,BufRead *.povsetf pov" Povray configurationau BufNewFile,BufRead .povrayrcsetf povini" Povray, PHP or assemblyau BufNewFile,BufRead *.inccall s:FTinc()func! s:FTinc() if exists("g:filetype_inc") exe "setf " . g:filetype_inc else let lines = getline(1).getline(2).getline(3) if lines =~? "perlscript" setf aspperl elseif lines =~ "<%" setf aspvbs elseif lines =~ "<?" setf php else call s:FTasmsyntax() if exists("b:asmsyntax")exe "setf " . fnameescape(b:asmsyntax) elsesetf pov endif endif endifendfunc" Printcap and Termcapau BufNewFile,BufRead *printcap\ let b:ptcap_type = "print" | setf ptcapau BufNewFile,BufRead *termcap\ let b:ptcap_type = "term" | setf ptcap" PCCTS / ANTRL"au BufNewFile,BufRead *.gsetf antrlau BufNewFile,BufRead *.gsetf pccts" PPWizardau BufNewFile,BufRead *.it,*.ihsetf ppwiz" Obj 3D file format" TODO: is there a way to avoid MS-Windows Object files?au BufNewFile,BufRead *.obj setf obj" Oracle Pro*C/C++au BufNewFile,BufRead *.pcsetf proc" Privoxy actions fileau BufNewFile,BufRead *.actionsetf privoxy" Procmailau BufNewFile,BufRead .procmail,.procmailrcsetf procmail" Progress or CWEBau BufNewFile,BufRead *.wcall s:FTprogress_cweb()func! s:FTprogress_cweb() if exists("g:filetype_w") exe "setf " . g:filetype_w return endif if getline(1) =~ '&ANALYZE' || getline(3) =~ '&GLOBAL-DEFINE' setf progress else setf cweb endifendfunc" Progress or assemblyau BufNewFile,BufRead *.icall s:FTprogress_asm()func! s:FTprogress_asm() if exists("g:filetype_i") exe "setf " . g:filetype_i return endif " This function checks for an assembly comment the first ten lines. " If not found, assume Progress. let lnum = 1 while lnum <= 10 && lnum < line('$') let line = getline(lnum) if line =~ '^\s*;' || line =~ '^\*' call s:FTasm() return elseif line !~ '^\s*$' || line =~ '^/\*' " Not an empty line: Doesn't look like valid assembly code. " Or it looks like a Progress /* comment break endif let lnum = lnum + 1 endw setf progressendfunc" Progress or Pascalau BufNewFile,BufRead *.pcall s:FTprogress_pascal()func! s:FTprogress_pascal() if exists("g:filetype_p") exe "setf " . g:filetype_p return endif " This function checks for valid Pascal syntax in the first ten lines. " Look for either an opening comment or a program start. " If not found, assume Progress. let lnum = 1 while lnum <= 10 && lnum < line('$') let line = getline(lnum) if line =~ '^\s*\(program\|unit\|procedure\|function\|const\|type\|var\)\>'\ || line =~ '^\s*{' || line =~ '^\s*(\*' setf pascal return elseif line !~ '^\s*$' || line =~ '^/\*' " Not an empty line: Doesn't look like valid Pascal code. " Or it looks like a Progress /* comment break endif let lnum = lnum + 1 endw setf progressendfunc" Software Distributor Product Specification File (POSIX 1387.2-1995)au BufNewFile,BufRead *.psfsetf psfau BufNewFile,BufRead INDEX,INFO\ if getline(1) =~ '^\s*\(distribution\|installed_software\|root\|bundle\|product\)\s*$' |\ setf psf |\ endif" Prologau BufNewFile,BufRead *.pdbsetf prolog" Promelaau BufNewFile,BufRead *.pmlsetf promela" Protocolsau BufNewFile,BufRead /etc/protocolssetf protocols" Pyrexau BufNewFile,BufRead *.pyx,*.pxdsetf pyrex" Pythonau BufNewFile,BufRead *.py,*.pywsetf python" Quixote (Python-based web framework)au BufNewFile,BufRead *.ptlsetf python" Radianceau BufNewFile,BufRead *.rad,*.matsetf radiance" Ratpoison config/command filesau BufNewFile,BufRead .ratpoisonrc,ratpoisonrcsetf ratpoison" RCS fileau BufNewFile,BufRead *\,vsetf rcs" Readlineau BufNewFile,BufRead .inputrc,inputrcsetf readline" Registry for MS-Windowsau BufNewFile,BufRead *.reg\ if getline(1) =~? '^REGEDIT[0-9]*\s*$\|^Windows Registry Editor Version \d*\.\d*\s*$' | setf registry | endif" Renderman Interface Bytestreamau BufNewFile,BufRead *.ribsetf rib" Rexxau BufNewFile,BufRead *.rexx,*.rex,*.jrexx,*.rxj,*.orxsetf rexx" R (Splus)if has("fname_case") au BufNewFile,BufRead *.s,*.Ssetf relse au BufNewFile,BufRead *.ssetf rendif" R Help fileif has("fname_case") au BufNewFile,BufRead *.rd,*.Rdsetf rhelpelse au BufNewFile,BufRead *.rdsetf rhelpendif" R noweb fileif has("fname_case") au BufNewFile,BufRead *.Rnw,*.rnw,*.Snw,*.snwsetf rnowebelse au BufNewFile,BufRead *.rnw,*.snwsetf rnowebendif" Rexx, Rebol or Rau BufNewFile,BufRead *.r,*.Rcall s:FTr()func! s:FTr() let max = line("$") > 50 ? 50 : line("$") for n in range(1, max) " Rebol is easy to recognize, check for that first if getline(n) =~? '\<REBOL\>' setf rebol return endif endfor for n in range(1, max) " R has # comments if getline(n) =~ '^\s*#' setf r return endif " Rexx has /* comments */ if getline(n) =~ '^\s*/\*' setf rexx return endif endfor " Nothing recognized, assume Rexx setf rexxendfunc" Remindau BufNewFile,BufRead .reminders*call s:StarSetf('remind')au BufNewFile,BufRead *.remind,*.remsetf remind" Resolv.confau BufNewFile,BufRead resolv.confsetf resolv" Relax NG Compactau BufNewFile,BufRead *.rncsetf rnc" RPL/2au BufNewFile,BufRead *.rplsetf rpl" Robots.txtau BufNewFile,BufRead robots.txtsetf robots" Rpcgenau BufNewFile,BufRead *.xsetf rpcgen" reStructuredText Documentation Formatau BufNewFile,BufRead *.rstsetf rst" RTFau BufNewFile,BufRead *.rtfsetf rtf" Interactive Ruby shellau BufNewFile,BufRead .irbrc,irbrcsetf ruby" Rubyau BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspecsetf ruby" Ruby on Railsau BufNewFile,BufRead *.builder,*.rxml,*.rjssetf ruby" Rantfile and Rakefile is like Rubyau BufNewFile,BufRead [rR]antfile,*.rant,[rR]akefile,*.rakesetf ruby" S-lang (or shader language, or SmallLisp)au BufNewFile,BufRead *.slsetf slang" Samba configau BufNewFile,BufRead smb.confsetf samba" SAS scriptau BufNewFile,BufRead *.sassetf sas" Sassau BufNewFile,BufRead *.sasssetf sass" Satherau BufNewFile,BufRead *.sasetf sather" Scilabau BufNewFile,BufRead *.sci,*.scesetf scilab" SCSSau BufNewFile,BufRead *.scss setf scss" SD: Streaming Descriptorsau BufNewFile,BufRead *.sdsetf sd" SDLau BufNewFile,BufRead *.sdl,*.prsetf sdl" sedau BufNewFile,BufRead *.sedsetf sed" Sieve (RFC 3028)au BufNewFile,BufRead *.sivsetf sieve" Sendmailau BufNewFile,BufRead sendmail.cfsetf sm" Sendmail .mc files are actually m4. Could also be MS Message text file.au BufNewFile,BufRead *.mccall s:McSetf()func! s:McSetf() " Rely on the file to start with a comment. " MS message text files use ';', Sendmail files use '#' or 'dnl' for lnum in range(1, min([line("$"), 20])) let line = getline(lnum) if line =~ '^\s*\(#\|dnl\)' setf m4 " Sendmail .mc file return elseif line =~ '^\s*;' setf msmessages " MS Message text file return endif endfor setf m4 " Default: Sendmail .mc fileendfunc" Servicesau BufNewFile,BufRead /etc/servicessetf services" Service Location configau BufNewFile,BufRead /etc/slp.confsetf slpconf" Service Location registrationau BufNewFile,BufRead /etc/slp.regsetf slpreg" Service Location SPIau BufNewFile,BufRead /etc/slp.spisetf slpspi" Setserial configau BufNewFile,BufRead /etc/serial.confsetf setserial" SGMLau BufNewFile,BufRead *.sgm,*.sgml\ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'linuxdoc' |\ setf sgmllnx |\ elseif getline(1) =~ '<!DOCTYPE.*DocBook' || getline(2) =~ '<!DOCTYPE.*DocBook' |\ let b:docbk_type="sgml" |\ setf docbk |\ else |\ setf sgml |\ endif" SGMLDECLau BufNewFile,BufRead *.decl,*.dcl,*.dec\ if getline(1).getline(2).getline(3) =~? '^<!SGML' |\ setf sgmldecl |\ endif" SGML catalog fileau BufNewFile,BufRead catalogsetf catalogau BufNewFile,BufRead sgml.catalog*call s:StarSetf('catalog')" Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc." Gentoo ebuilds are actually bash scriptsau BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,*.bash,*.ebuild call SetFileTypeSH("bash")au BufNewFile,BufRead .kshrc*,*.ksh call SetFileTypeSH("ksh")au BufNewFile,BufRead /etc/profile,.profile*,*.sh,*.env call SetFileTypeSH(getline(1))" Also called from scripts.vim.func! SetFileTypeSH(name) if expand("<amatch>") =~ g:ft_ignore_pat return endif if a:name =~ '\<csh\>' " Some .sh scripts contain #!/bin/csh. call SetFileTypeShell("csh") return elseif a:name =~ '\<tcsh\>' " Some .sh scripts contain #!/bin/tcsh. call SetFileTypeShell("tcsh") return elseif a:name =~ '\<ksh\>' let b:is_kornshell = 1 if exists("b:is_bash") unlet b:is_bash endif if exists("b:is_sh") unlet b:is_sh endif elseif exists("g:bash_is_sh") || a:name =~ '\<bash\>' || a:name =~ '\<bash2\>' let b:is_bash = 1 if exists("b:is_kornshell") unlet b:is_kornshell endif if exists("b:is_sh") unlet b:is_sh endif elseif a:name =~ '\<sh\>' let b:is_sh = 1 if exists("b:is_kornshell") unlet b:is_kornshell endif if exists("b:is_bash") unlet b:is_bash endif endif call SetFileTypeShell("sh")endfunc" For shell-like file types, check for an "exec" command hidden in a comment," as used for Tcl." Also called from scripts.vim, thus can't be local to this script.func! SetFileTypeShell(name) if expand("<amatch>") =~ g:ft_ignore_pat return endif let l = 2 while l < 20 && l < line("$") && getline(l) =~ '^\s*\(#\|$\)' " Skip empty and comment lines. let l = l + 1 endwhile if l < line("$") && getline(l) =~ '\s*exec\s' && getline(l - 1) =~ '^\s*#.*\\$' " Found an "exec" line after a comment with continuation let n = substitute(getline(l),'\s*exec\s\+\([^ ]*/\)\=', '', '') if n =~ '\<tclsh\|\<wish' setf tcl return endif endif exe "setf " . a:nameendfunc" tcsh scriptsau BufNewFile,BufRead .tcshrc*,*.tcsh,tcsh.tcshrc,tcsh.logincall SetFileTypeShell("tcsh")" csh scripts, but might also be tcsh scripts (on some systems csh is tcsh)au BufNewFile,BufRead .login*,.cshrc*,csh.cshrc,csh.login,csh.logout,*.csh,.alias call s:CSH()func! s:CSH() if exists("g:filetype_csh") call SetFileTypeShell(g:filetype_csh) elseif &shell =~ "tcsh" call SetFileTypeShell("tcsh") else call SetFileTypeShell("csh") endifendfunc" Z-Shell scriptau BufNewFile,BufRead .zprofile,/etc/zprofile,.zfbfmarks setf zshau BufNewFile,BufRead .zsh*,.zlog*,.zcompdump* call s:StarSetf('zsh')au BufNewFile,BufRead *.zsh setf zsh" Schemeau BufNewFile,BufRead *.scm,*.sssetf scheme" Screen RCau BufNewFile,BufRead .screenrc,screenrcsetf screen" Simulaau BufNewFile,BufRead *.simsetf simula" SINDAau BufNewFile,BufRead *.sin,*.s85setf sinda" SiSUau BufNewFile,BufRead *.sst,*.ssm,*.ssi,*.-sst,*._sst setf sisuau BufNewFile,BufRead *.sst.meta,*.-sst.meta,*._sst.meta setf sisu" SKILLau BufNewFile,BufRead *.il,*.ils,*.cdfsetf skill" SLRNau BufNewFile,BufRead .slrnrcsetf slrnrcau BufNewFile,BufRead *.scoresetf slrnsc" Smalltalk (and TeX)au BufNewFile,BufRead *.stsetf stau BufNewFile,BufRead *.cls\ if getline(1) =~ '^%' |\ setf tex |\ else |\ setf st |\ endif" Smarty templatesau BufNewFile,BufRead *.tplsetf smarty" SMIL or XMLau BufNewFile,BufRead *.smil\ if getline(1) =~ '<?\s*xml.*?>' |\ setf xml |\ else |\ setf smil |\ endif" SMIL or SNMP MIB fileau BufNewFile,BufRead *.smi\ if getline(1) =~ '\<smil\>' |\ setf smil |\ else |\ setf mib |\ endif" SMITHau BufNewFile,BufRead *.smt,*.smithsetf smith" Snobol4 and spitbolau BufNewFile,BufRead *.sno,*.sptsetf snobol4" SNMP MIB filesau BufNewFile,BufRead *.mib,*.mysetf mib" Snort Configurationau BufNewFile,BufRead *.hog,snort.conf,vision.confsetf hogau BufNewFile,BufRead *.rulescall s:FTRules()let s:ft_rules_udev_rules_pattern = '^\s*\cudev_rules\s*=\s*"\([^"]\{-1,}\)/*".*'func! s:FTRules() let path = expand('<amatch>:p') if path =~ '^/etc/udev/\%(rules\.d/\)\=.*\.rules$' setf udevrules return endif if path =~ '^/etc/ufw/' setf conf " Better than hog return endif try let config_lines = readfile('/etc/udev/udev.conf') catch /^Vim\%((\a\+)\)\=:E484/ setf hog return endtry let dir = expand('<amatch>:p:h') for line in config_lines if line =~ s:ft_rules_udev_rules_pattern let udev_rules = substitute(line, s:ft_rules_udev_rules_pattern, '\1', "") if dir == udev_rules setf udevrules endif break endif endfor setf hogendfunc" Spec (Linux RPM)au BufNewFile,BufRead *.specsetf spec" Speedup (AspenTech plant simulator)au BufNewFile,BufRead *.speedup,*.spdata,*.spdsetf spup" Sliceau BufNewFile,BufRead *.icesetf slice" Spiceau BufNewFile,BufRead *.sp,*.spicesetf spice" Spyceau BufNewFile,BufRead *.spy,*.spisetf spyce" Squidau BufNewFile,BufRead squid.confsetf squid" SQL for Oracle Designerau BufNewFile,BufRead *.tyb,*.typ,*.tyc,*.pkb,*.pkssetf sql" SQLau BufNewFile,BufRead *.sqlcall s:SQL()func! s:SQL() if exists("g:filetype_sql") exe "setf " . g:filetype_sql else setf sql endifendfunc" SQLJau BufNewFile,BufRead *.sqljsetf sqlj" SQRau BufNewFile,BufRead *.sqr,*.sqisetf sqr" OpenSSH configurationau BufNewFile,BufRead ssh_config,*/.ssh/configsetf sshconfig" OpenSSH server configurationau BufNewFile,BufRead sshd_configsetf sshdconfig" Stataau BufNewFile,BufRead *.ado,*.class,*.do,*.imata,*.mata setf stata" SMCLau BufNewFile,BufRead *.hlp,*.ihlp,*.smclsetf smcl" Stored Proceduresau BufNewFile,BufRead *.stpsetf stp" Standard MLau BufNewFile,BufRead *.smlsetf sml" Sratus VOS command macroau BufNewFile,BufRead *.cmsetf voscm" Sysctlau BufNewFile,BufRead /etc/sysctl.confsetf sysctl" Synopsys Design Constraintsau BufNewFile,BufRead *.sdcsetf sdc" Sudoersau BufNewFile,BufRead /etc/sudoers,sudoers.tmpsetf sudoers" SVG (Scalable Vector Graphics)au BufNewFile,BufRead *.svgsetf svg" If the file has an extension of 't' and is in a directory 't' then it is" almost certainly a Perl test file." If the first line starts with '#' and contains 'perl' it's probably a Perl" file." (Slow test) If a file contains a 'use' statement then it is almost certainly" a Perl file.func! s:FTperl() if expand("%:e") == 't' && expand("%:p:h:t") == 't' setf perl return 1 endif if getline(1)[0] == '#' && getline(1) =~ 'perl' setf perl return 1 endif if search('^use\s\s*\k', 'nc', 30) setf perl return 1 endif return 0endfunc" Tads (or Nroff or Perl test file)au BufNewFile,BufRead *.t\ if !s:FTnroff() && !s:FTperl() | setf tads | endif" Tagsau BufNewFile,BufRead tagssetf tags" TAKau BufNewFile,BufRead *.taksetf tak" Taskau BufRead,BufNewFile {pending,completed,undo}.data setf taskdataau BufRead,BufNewFile *.task setf taskedit" Tcl (JACL too)au BufNewFile,BufRead *.tcl,*.tk,*.itcl,*.itk,*.jaclsetf tcl" TealInfoau BufNewFile,BufRead *.tlisetf tli" Telix Saltau BufNewFile,BufRead *.sltsetf tsalt" Terminfoau BufNewFile,BufRead *.tisetf terminfo" TeXau BufNewFile,BufRead *.latex,*.sty,*.dtx,*.ltx,*.bblsetf texau BufNewFile,BufRead *.texcall s:FTtex()" Choose context, plaintex, or tex (LaTeX) based on these rules:" 1. Check the first line of the file for "%&<format>"." 2. Check the first 1000 non-comment lines for LaTeX or ConTeXt keywords." 3. Default to "latex" or to g:tex_flavor, can be set in user's vimrc.func! s:FTtex() let firstline = getline(1) if firstline =~ '^%&\s*\a\+' let format = tolower(matchstr(firstline, '\a\+')) let format = substitute(format, 'pdf', '', '') if format == 'tex' let format = 'plain' endif else " Default value, may be changed later: let format = exists("g:tex_flavor") ? g:tex_flavor : 'plain' " Save position, go to the top of the file, find first non-comment line. let save_cursor = getpos('.') call cursor(1,1) let firstNC = search('^\s*[^[:space:]%]', 'c', 1000) if firstNC " Check the next thousand lines for a LaTeX or ConTeXt keyword. let lpat = 'documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>' let cpat = 'start\a\+\|setup\a\+\|usemodule\|enablemode\|enableregime\|setvariables\|useencoding\|usesymbols\|stelle\a\+\|verwende\a\+\|stel\a\+\|gebruik\a\+\|usa\a\+\|imposta\a\+\|regle\a\+\|utilisemodule\>' let kwline = search('^\s*\\\%(' . lpat . '\)\|^\s*\\\(' . cpat . '\)', \ 'cnp', firstNC + 1000) if kwline == 1" lpat matchedlet format = 'latex' elseif kwline == 2" cpat matchedlet format = 'context' endif" If neither matched, keep default set above. " let lline = search('^\s*\\\%(' . lpat . '\)', 'cn', firstNC + 1000) " let cline = search('^\s*\\\%(' . cpat . '\)', 'cn', firstNC + 1000) " if cline > 0 " let format = 'context' " endif " if lline > 0 && (cline == 0 || cline > lline) " let format = 'tex' " endif endif " firstNC call setpos('.', save_cursor) endif " firstline =~ '^%&\s*\a\+' " Translation from formats to file types. TODO: add AMSTeX, RevTex, others? if format == 'plain' setf plaintex elseif format == 'context' setf context else " probably LaTeX setf tex endif returnendfunc" ConTeXtau BufNewFile,BufRead tex/context/*/*.tex,*.mkii,*.mkiv setf context" Texinfoau BufNewFile,BufRead *.texinfo,*.texi,*.txisetf texinfo" TeX configurationau BufNewFile,BufRead texmf.cnfsetf texmf" Tidy configau BufNewFile,BufRead .tidyrc,tidyrcsetf tidy" TF mud clientau BufNewFile,BufRead *.tf,.tfrc,tfrcsetf tf" TPP - Text Presentation Programau BufNewFile,BufReadPost *.tppsetf tpp" Trusteesau BufNewFile,BufRead trustees.confsetf trustees" TSS - Geometryau BufNewFile,BufReadPost *.tssgmsetf tssgm" TSS - Opticsau BufNewFile,BufReadPost *.tssopsetf tssop" TSS - Command Line (temporary)au BufNewFile,BufReadPost *.tssclsetf tsscl" Motif UIT/UIL filesau BufNewFile,BufRead *.uit,*.uilsetf uil" Udev confau BufNewFile,BufRead /etc/udev/udev.confsetf udevconf" Udev permissionsau BufNewFile,BufRead /etc/udev/permissions.d/*.permissions setf udevperm"" Udev symlinks configau BufNewFile,BufRead /etc/udev/cdsymlinks.confsetf sh" UnrealScriptau BufNewFile,BufRead *.ucsetf uc" Updatedbau BufNewFile,BufRead /etc/updatedb.confsetf updatedb" Veraau BufNewFile,BufRead *.vr,*.vri,*.vrhsetf vera" Verilog HDLau BufNewFile,BufRead *.vsetf verilog" Verilog-AMS HDLau BufNewFile,BufRead *.va,*.vamssetf verilogams" VHDLau BufNewFile,BufRead *.hdl,*.vhd,*.vhdl,*.vbe,*.vst setf vhdlau BufNewFile,BufRead *.vhdl_[0-9]*call s:StarSetf('vhdl')" Vim scriptau BufNewFile,BufRead *.vim,*.vba,.exrc,_exrcsetf vim" Viminfo fileau BufNewFile,BufRead .viminfo,_viminfosetf viminfo" Virata Config Script File or Drupal moduleau BufRead,BufNewFile *.hw,*.module,*.pkg\ if getline(1) =~ '<?php' |\ setf php |\ else |\ setf virata |\ endif" Visual Basic (also uses *.bas) or FORMau BufNewFile,BufRead *.frmcall s:FTVB("form")" SaxBasic is close to Visual Basicau BufNewFile,BufRead *.sbasetf vb" Vgrindefs fileau BufNewFile,BufRead vgrindefssetf vgrindefs" VRML V1.0cau BufNewFile,BufRead *.wrlsetf vrml" Webmacroau BufNewFile,BufRead *.wmsetf webmacro" Wget configau BufNewFile,BufRead .wgetrc,wgetrcsetf wget" Website MetaLanguageau BufNewFile,BufRead *.wmlsetf wml" Winbatchau BufNewFile,BufRead *.wbtsetf winbatch" WSMLau BufNewFile,BufRead *.wsmlsetf wsml" WvDialau BufNewFile,BufRead wvdial.conf,.wvdialrcsetf wvdial" CVS RC fileau BufNewFile,BufRead .cvsrcsetf cvsrc" CVS commit fileau BufNewFile,BufRead cvs\d\+setf cvs" WEB (*.web is also used for Winbatch: Guess, based on expecting "%" comment" lines in a WEB file).au BufNewFile,BufRead *.web\ if getline(1)[0].getline(2)[0].getline(3)[0].getline(4)[0].getline(5)[0] =~ "%" |\ setf web |\ else |\ setf winbatch |\ endif" Windows Scripting Host and Windows Script Componentau BufNewFile,BufRead *.ws[fc]setf wsh" XHTMLau BufNewFile,BufRead *.xhtml,*.xhtsetf xhtml" X Pixmap (dynamically sets colors, use BufEnter to make it work better)au BufEnter *.xpm\ if getline(1) =~ "XPM2" |\ setf xpm2 |\ else |\ setf xpm |\ endifau BufEnter *.xpm2setf xpm2" XFree86 configau BufNewFile,BufRead XF86Config\ if getline(1) =~ '\<XConfigurator\>' |\ let b:xf86c_xfree86_version = 3 |\ endif |\ setf xf86conf" Xorg configau BufNewFile,BufRead xorg.conf,xorg.conf-4let b:xf86c_xfree86_version = 4 | setf xf86conf" Xinetd confau BufNewFile,BufRead /etc/xinetd.confsetf xinetd" XS Perl extension interface languageau BufNewFile,BufRead *.xssetf xs" X resources fileau BufNewFile,BufRead .Xdefaults,.Xpdefaults,.Xresources,xdm-config,*.ad setf xdefaults" Xmathau BufNewFile,BufRead *.msc,*.msfsetf xmathau BufNewFile,BufRead *.ms\ if !s:FTnroff() | setf xmath | endif" XML specific variants: docbk and xblau BufNewFile,BufRead *.xmlcall s:FTxml()func! s:FTxml() let n = 1 while n < 100 && n < line("$") let line = getline(n) if line =~ '<!DOCTYPE.*DocBook' let b:docbk_type = "xml" setf docbk return endif if line =~ 'xmlns:xbl="http://www.mozilla.org/xbl"' setf xbl return endif let n += 1 endwhile setf xmlendfunc" XMI (holding UML models) is also XMLau BufNewFile,BufRead *.xmisetf xml" CSPROJ files are Visual Studio.NET's XML-based project config filesau BufNewFile,BufRead *.csproj,*.csproj.usersetf xml" Qt Linguist translation source and Qt User Interface Files are XMLau BufNewFile,BufRead *.ts,*.uisetf xml" TPM's are RDF-based descriptions of TeX packages (Nikolai Weibull)au BufNewFile,BufRead *.tpmsetf xml" Xdg menusau BufNewFile,BufRead /etc/xdg/menus/*.menusetf xml" ATI graphics driver configurationau BufNewFile,BufRead fglrxrcsetf xml" XLIFF (XML Localisation Interchange File Format) is also XMLau BufNewFile,BufRead *.xlfsetf xmlau BufNewFile,BufRead *.xliffsetf xml" X11 xmodmap (also see below)au BufNewFile,BufRead *Xmodmapsetf xmodmap" Xqueryau BufNewFile,BufRead *.xq,*.xql,*.xqm,*.xquery,*.xqysetf xquery" XSDau BufNewFile,BufRead *.xsdsetf xsd" Xsltau BufNewFile,BufRead *.xsl,*.xsltsetf xslt" Yaccau BufNewFile,BufRead *.yysetf yacc" Yacc or raccau BufNewFile,BufRead *.ycall s:FTy()func! s:FTy() let n = 1 while n < 100 && n < line("$") let line = getline(n) if line =~ '^\s*%' setf yacc return endif if getline(n) =~ '^\s*\(#\|class\>\)' && getline(n) !~ '^\s*#\s*include' setf racc return endif let n = n + 1 endwhile setf yaccendfunc" Yamlau BufNewFile,BufRead *.yaml,*.ymlsetf yaml" Zope" dtml (zope dynamic template markup language), pt (zope page template)," cpt (zope form controller page template)au BufNewFile,BufRead *.dtml,*.pt,*.cptcall s:FThtml()" zsql (zope sql method)au BufNewFile,BufRead *.zsqlcall s:SQL()" Z80 assembler asz80au BufNewFile,BufRead *.z8asetf z8aaugroup END" Source the user-specified filetype file, for backwards compatibility with" Vim 5.x.if exists("myfiletypefile") && filereadable(expand(myfiletypefile)) execute "source " . myfiletypefileendif" Check for "*" after loading myfiletypefile, so that scripts.vim is only used" when there are no matching file name extensions." Don't do this for compressed files.augroup filetypedetectau BufNewFile,BufRead *\ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat\ | runtime! scripts.vim | endifau StdinReadPost * if !did_filetype() | runtime! scripts.vim | endif" Extra checks for when no filetype has been detected now. Mostly used for" patterns that end in "*". E.g., "zsh*" matches "zsh.vim", but that's a Vim" script file." Most of these should call s:StarSetf() to avoid names ending in .gz and the" like are used." More Apache files.au BufNewFile,BufRead /etc/apache2/conf.*/*,/etc/apache2/sites-*/*,/etc/apache2/mods-*/*call s:StarSetf('apache')" Asterisk config fileau BufNewFile,BufRead *asterisk/*.conf*call s:StarSetf('asterisk')au BufNewFile,BufRead *asterisk*/*voicemail.conf* call s:StarSetf('asteriskvm')" Bazaar version controlau BufNewFile,BufRead bzr_log.*setf bzr" BIND zoneau BufNewFile,BufRead */named/db.*,*/bind/db.*call s:StarSetf('bindzone')" Changelogau BufNewFile,BufRead [cC]hange[lL]og*\ if getline(1) =~ '; urgency='\| call s:StarSetf('debchangelog')\|else\| call s:StarSetf('changelog')\|endif" Crontabau BufNewFile,BufRead crontab,crontab.*,/etc/cron.d/*call s:StarSetf('crontab')" Debian Sources.listau BufNewFile,BufRead /etc/apt/sources.list.d/*call s:StarSetf('debsources')" Draculaau BufNewFile,BufRead drac.*call s:StarSetf('dracula')" Fvwmau BufNewFile,BufRead */.fvwm/*call s:StarSetf('fvwm')au BufNewFile,BufRead *fvwmrc*,*fvwm95*.hook\ let b:fvwm_version = 1 | call s:StarSetf('fvwm')au BufNewFile,BufRead *fvwm2rc*\ if expand("<afile>:e") == "m4"\| call s:StarSetf('fvwm2m4')\|else\| let b:fvwm_version = 2 | call s:StarSetf('fvwm')\|endif" Gedcomau BufNewFile,BufRead /tmp/lltmp*call s:StarSetf('gedcom')" GTK RCau BufNewFile,BufRead .gtkrc*,gtkrc*call s:StarSetf('gtkrc')" Jamau BufNewFile,BufRead Prl*.*,JAM*.*call s:StarSetf('jam')" Jargonau! BufNewFile,BufRead *jarg*\ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'THIS IS THE JARGON FILE'\| call s:StarSetf('jargon')\|endif" Kconfigau BufNewFile,BufRead Kconfig.*call s:StarSetf('kconfig')" Logcheckau BufNewFile,BufRead /etc/logcheck/*.d*/*call s:StarSetf('logcheck')" Makefileau BufNewFile,BufRead [mM]akefile*call s:StarSetf('make')" Ruby Makefileau BufNewFile,BufRead [rR]akefile*call s:StarSetf('ruby')" Mail (also matches muttrc.vim, so this is below the other checks)au BufNewFile,BufRead mutt[[:alnum:]._-]\{6\}setf mail" Modconfau BufNewFile,BufRead /etc/modprobe.*call s:StarSetf('modconf')" Mutt setup fileau BufNewFile,BufRead .mutt{ng,}rc*,*/.mutt{ng,}/mutt{ng,}rc*call s:StarSetf('muttrc')au BufNewFile,BufRead mutt{ng,}rc*,Mutt{ng,}rc*call s:StarSetf('muttrc')" Nroff macrosau BufNewFile,BufRead tmac.*call s:StarSetf('nroff')" Pam confau BufNewFile,BufRead /etc/pam.d/*call s:StarSetf('pamconf')" Printcap and Termcapau BufNewFile,BufRead *printcap*\ if !did_filetype()\| let b:ptcap_type = "print" | call s:StarSetf('ptcap')\|endifau BufNewFile,BufRead *termcap*\ if !did_filetype()\| let b:ptcap_type = "term" | call s:StarSetf('ptcap')\|endif" Vim scriptau BufNewFile,BufRead *vimrc*call s:StarSetf('vim')" Subversion commit fileau BufNewFile,BufRead svn-commit*.tmpsetf svn" X resources fileau BufNewFile,BufRead Xresources*,*/app-defaults/*,*/Xresources/* call s:StarSetf('xdefaults')" XFree86 configau BufNewFile,BufRead XF86Config-4*\ let b:xf86c_xfree86_version = 4 | call s:StarSetf('xf86conf')au BufNewFile,BufRead XF86Config*\ if getline(1) =~ '\<XConfigurator\>'\| let b:xf86c_xfree86_version = 3\|endif\|call s:StarSetf('xf86conf')" X11 xmodmapau BufNewFile,BufRead *xmodmap*call s:StarSetf('xmodmap')" Xinetd confau BufNewFile,BufRead /etc/xinetd.d/*call s:StarSetf('xinetd')" Z-Shell scriptau BufNewFile,BufRead zsh*,zlog*call s:StarSetf('zsh')" Use the filetype detect plugins. They may overrule any of the previously" detected filetypes.runtime! ftdetect/*.vim" NOTE: The above command could have ended the filetypedetect autocmd group" and started another one. Let's make sure it has ended to get to a consistant" state.augroup END" Generic configuration file (check this last, it's just guessing!)au filetypedetect BufNewFile,BufRead,StdinReadPost *\ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat\ && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#'\|| getline(4) =~ '^#' || getline(5) =~ '^#') |\ setf conf |\ endif" If the GUI is already running, may still need to install the Syntax menu." Don't do it when the 'M' flag is included in 'guioptions'.if has("menu") && has("gui_running") \ && !exists("did_install_syntax_menu") && &guioptions !~# "M" source <sfile>:p:h/menu.vimendif" Function called for testing all functions defined here. These are" script-local, thus need to be executed here." Returns a string with error messages (hopefully empty).func! TestFiletypeFuncs(testlist) let output = '' for f in a:testlist try exe f catch let output = output . "\n" . f . ": " . v:exception endtry endfor return outputendfunc" Restore 'cpoptions'let &cpo = s:cpo_saveunlet s:cpo_save