diff options
-rw-r--r-- | .vim/filetype.vim | 334 |
1 files changed, 240 insertions, 94 deletions
diff --git a/.vim/filetype.vim b/.vim/filetype.vim index 19d191c..9162750 100644 --- a/.vim/filetype.vim +++ b/.vim/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2008 Aug 03 +" Last Change: 2012 Feb 03 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -116,12 +116,15 @@ au BufNewFile,BufRead httpd.conf*,srm.conf*,access.conf*,apache.conf*,apache2.co " XA65 MOS6510 cross assembler au BufNewFile,BufRead *.a65 setf a65 +" Applescript +au BufNewFile,BufRead *.scpt setf applescript + " Applix ELF au BufNewFile,BufRead *.am \ if expand("<afile>") !~? 'Makefile.am\>' | setf elf | endif " ALSA configuration -au BufNewFile,BufRead ~/.asoundrc,/usr/share/alsa/alsa.conf,/etc/asound.conf setf alsaconf +au BufNewFile,BufRead .asoundrc,*/usr/share/alsa/alsa.conf,*/etc/asound.conf setf alsaconf " Arc Macro Language au BufNewFile,BufRead *.aml setf aml @@ -154,7 +157,7 @@ au BufNewFile,BufRead *.asp \ endif " Grub (must be before catch *.lst) -au BufNewFile,BufRead /boot/grub/menu.lst,/boot/grub/grub.conf,/etc/grub.conf setf grub +au BufNewFile,BufRead */boot/grub/menu.lst,*/boot/grub/grub.conf,*/etc/grub.conf setf grub " Assembly (all kinds) " *.lst is not pure assembly, it has two extra columns (address, byte codes) @@ -296,7 +299,7 @@ endfunc au BufNewFile,BufRead *.bl setf blank " Blkid cache file -au BufNewFile,BufRead /etc/blkid.tab,/etc/blkid.tab.old setf xml +au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old setf xml " C or lpc au BufNewFile,BufRead *.c call s:FTlpc() @@ -324,15 +327,21 @@ au BufNewFile,BufRead */.calendar/*, " C# au BufNewFile,BufRead *.cs setf cs +" Cabal +au BufNewFile,BufRead *.cabal setf cabal + " Cdrdao TOC au BufNewFile,BufRead *.toc setf cdrtoc " Cdrdao config -au BufNewFile,BufRead etc/cdrdao.conf,etc/defaults/cdrdao,etc/default/cdrdao,~/.cdrdao setf cdrdaoconf +au BufNewFile,BufRead */etc/cdrdao.conf,*/etc/defaults/cdrdao,*/etc/default/cdrdao,.cdrdao setf cdrdaoconf " Cfengine au BufNewFile,BufRead cfengine.conf setf cfengine +" ChaiScript +au BufRead,BufNewFile *.chai setf chaiscript + " Comshare Dimension Definition Language au BufNewFile,BufRead *.cdl setf cdl @@ -353,10 +362,9 @@ au 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 cpp if has("fname_case") - au BufNewFile,BufRead *.cxx,*.c++,*.C,*.H,*.hh,*.hxx,*.hpp,*.moc,*.tcc,*.inl setf cpp -else - au BufNewFile,BufRead *.cxx,*.c++,*.hh,*.hxx,*.hpp,*.moc,*.tcc,*.inl setf cpp + au BufNewFile,BufRead *.C,*.H setf cpp endif " .h files can be C, Ch C++, ObjC or ObjC++. @@ -367,9 +375,9 @@ au BufNewFile,BufRead *.h call s:FTheader() func! s:FTheader() if match(getline(1, min([line("$"), 200])), '^@\(interface\|end\|class\)') > -1 setf objc - elseif exists("c_syntax_for_h") + elseif exists("g:c_syntax_for_h") setf c - elseif exists("ch_syntax_for_h") + elseif exists("g:ch_syntax_for_h") setf ch else setf cpp @@ -483,7 +491,7 @@ au BufNewFile,BufRead *.prg au BufNewFile,BufRead CMakeLists.txt,*.cmake,*.cmake.in setf cmake " Cmusrc -au BufNewFile,BufRead ~/.cmus/{autosave,rc,command-history,*.theme} setf cmusrc +au BufNewFile,BufRead */.cmus/{autosave,rc,command-history,*.theme} setf cmusrc au BufNewFile,BufRead */cmus/{rc,*.theme} setf cmusrc " Cobol @@ -530,6 +538,9 @@ au BufNewFile,BufRead *.qc setf c " Configure files au BufNewFile,BufRead *.cfg setf cfg +" Cucumber +au BufNewFile,BufRead *.feature setf cucumber + " Communicating Sequential Processes au BufNewFile,BufRead *.csp,*.fdr setf csp @@ -545,11 +556,15 @@ au BufNewFile,BufRead control \| endif " Debian Sources.list -au BufNewFile,BufRead /etc/apt/sources.list setf debsources +au BufNewFile,BufRead */etc/apt/sources.list setf debsources +au BufNewFile,BufRead */etc/apt/sources.list.d/*.list setf debsources " Deny hosts au BufNewFile,BufRead denyhosts.conf setf denyhosts +" dnsmasq(8) configuration files +au BufNewFile,BufRead */etc/dnsmasq.conf setf dnsmasq + " ROCKLinux package description au BufNewFile,BufRead *.desc setf desc @@ -558,7 +573,10 @@ au BufNewFile,BufRead *.d call 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 + if match(lines, '^module\>\|^import\>') > -1 + " D files often start with a module and/or import statement. + setf d + elseif match(lines, '^#!\S\+dtrace\|#pragma\s\+D\s\+option\|:\S\{-}:\S\{-}:') > -1 setf dtrace else setf d @@ -578,7 +596,7 @@ au BufNewFile,BufRead dictd.conf setf dictdconf au BufNewFile,BufRead *.diff,*.rej,*.patch setf diff " Dircolors -au BufNewFile,BufRead .dir_colors,/etc/DIR_COLORS setf dircolors +au BufNewFile,BufRead .dir_colors,.dircolors,*/etc/DIR_COLORS setf dircolors " Diva (with Skill) or InstallShield au BufNewFile,BufRead *.rul @@ -609,6 +627,9 @@ au BufNewFile,BufRead *.def setf def " Dracula au BufNewFile,BufRead *.drac,*.drc,*lvs,*lpe setf dracula +" Datascript +au BufNewFile,BufRead *.ds setf datascript + " dsl au BufNewFile,BufRead *.dsl setf dsl @@ -669,14 +690,21 @@ au BufNewFile,BufRead *.exp setf expect " Exports au BufNewFile,BufRead exports setf exports +" Falcon +au BufNewFile,BufRead *.fal setf falcon + +" Fantom +au BufNewFile,BufRead *.fan,*.fwt setf fan + " Factor au BufNewFile,BufRead *.factor setf factor " Fetchmail RC file au BufNewFile,BufRead .fetchmailrc setf fetchmail -" FlexWiki -au BufNewFile,BufRead *.wiki setf flexwiki +" FlexWiki - disabled, because it has side effects when a .wiki file +" is not actually FlexWiki +"au BufNewFile,BufRead *.wiki setf flexwiki " Focus Executable au BufNewFile,BufRead *.fex,*.focexec setf focexec @@ -693,9 +721,9 @@ au BufNewFile,BufRead *.frt setf reva " Fortran if has("fname_case") - au BufNewFile,BufRead *.F,*.FOR,*.FPP,*.FTN,*.F77,*.F90,*.F95 setf fortran + au BufNewFile,BufRead *.F,*.FOR,*.FPP,*.FTN,*.F77,*.F90,*.F95,*.F03,*.F08 setf fortran endif -au BufNewFile,BufRead *.f,*.for,*.fortran,*.fpp,*.ftn,*.f77,*.f90,*.f95 setf fortran +au BufNewFile,BufRead *.f,*.for,*.fortran,*.fpp,*.ftn,*.f77,*.f90,*.f95,*.f03,*.f08 setf fortran " Framescript au BufNewFile,BufRead *.fsl setf framescript @@ -710,17 +738,17 @@ au BufNewFile,BufRead .gdbinit setf gdb au BufNewFile,BufRead *.mo,*.gdmo setf gdmo " Gedcom -au BufNewFile,BufRead *.ged setf gedcom +au BufNewFile,BufRead *.ged,lltxxxxx.txt setf gedcom " Git -autocmd BufNewFile,BufRead *.git/COMMIT_EDITMSG setf gitcommit -autocmd BufNewFile,BufRead *.git/config,.gitconfig setf gitconfig -autocmd BufNewFile,BufRead git-rebase-todo setf gitrebase -autocmd BufNewFile,BufRead .msg.[0-9]* +au BufNewFile,BufRead *.git/COMMIT_EDITMSG setf gitcommit +au BufNewFile,BufRead *.git/config,.gitconfig,.gitmodules setf gitconfig +au BufNewFile,BufRead git-rebase-todo setf gitrebase +au BufNewFile,BufRead .msg.[0-9]* \ if getline(1) =~ '^From.*# This line is ignored.$' | \ setf gitsendemail | \ endif -autocmd BufNewFile,BufRead *.git/** +au BufNewFile,BufRead *.git/** \ if getline(1) =~ '^\x\{40\}\>\|^ref: ' | \ setf git | \ endif @@ -734,7 +762,15 @@ au BufNewFile,BufRead *.gp,.gprc setf gp " GPG au BufNewFile,BufRead */.gnupg/options setf gpg au BufNewFile,BufRead */.gnupg/gpg.conf setf gpg -au BufNewFile,BufRead /usr/**/gnupg/options.skel setf gpg +au BufNewFile,BufRead */usr/**/gnupg/options.skel setf gpg + +" gnash(1) configuration files +au BufNewFile,BufRead gnashrc,.gnashrc,gnashpluginrc,.gnashpluginrc setf gnash + +" Gitolite +au BufNewFile,BufRead gitolite.conf setf gitolite +au BufNewFile,BufRead */gitolite-admin/conf/* call s:StarSetf('gitolite') +au BufNewFile,BufRead {,.}gitolite.rc,example.gitolite.rc setf perl " Gnuplot scripts au BufNewFile,BufRead *.gpi setf gnuplot @@ -752,7 +788,7 @@ au BufNewFile,BufRead *.groovy setf groovy au BufNewFile,BufRead *.gsp setf gsp " Group file -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 +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 " GTK RC au BufNewFile,BufRead .gtkrc,gtkrc setf gtkrc @@ -811,10 +847,10 @@ au BufNewFile,BufRead *.html.m4 setf htmlm4 au BufNewFile,BufRead *.tmpl setf htmlcheetah " Host config -au BufNewFile,BufRead /etc/host.conf setf hostconf +au BufNewFile,BufRead */etc/host.conf setf hostconf " Hosts access -au BufNewFile,BufRead /etc/hosts.allow,/etc/hosts.deny setf hostsaccess +au BufNewFile,BufRead */etc/hosts.allow,*/etc/hosts.deny setf hostsaccess " Hyper Builder au BufNewFile,BufRead *.hb setf hb @@ -857,7 +893,9 @@ 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) =~ ';$' + " IDL files can have a single ';' in the second line, require at least one + " chacter before the ';'. + if getline(2) =~ '.;$' setf cpp else exe 'setf ' . a:default @@ -872,7 +910,7 @@ au BufNewFile,BufRead indentrc setf indent au BufNewFile,BufRead *.inf,*.INF setf inform " Initng -au BufNewFile,BufRead /etc/initng/**/*.i,*.ii setf initng +au BufNewFile,BufRead */etc/initng/**/*.i,*.ii setf initng " Ipfilter au BufNewFile,BufRead ipf.conf,ipf6.conf,ipf.rules setf ipfilter @@ -902,7 +940,7 @@ au BufNewFile,BufRead *.java,*.jav setf java au BufNewFile,BufRead *.jj,*.jjt setf javacc " JavaScript, ECMAScript -au BufNewFile,BufRead *.js,*.javascript,*.es setf javascript +au BufNewFile,BufRead *.js,*.javascript,*.es,*.jsx,*.json setf javascript " Java Server Pages au BufNewFile,BufRead *.jsp setf jsp @@ -917,6 +955,9 @@ au BufNewFile,BufRead *.clp setf jess " Jgraph au BufNewFile,BufRead *.jgr setf jgraph +" Jovial +au BufNewFile,BufRead *.jov,*.j73,*.jovial setf jovial + " Kixtart au BufNewFile,BufRead *.kix setf kix @@ -936,7 +977,7 @@ au BufNewFile,BufRead *.ace,*.ACE setf lace au BufNewFile,BufRead *.latte,*.lte setf latte " Limits -au BufNewFile,BufRead /etc/limits setf limits +au BufNewFile,BufRead */etc/limits,*/etc/*limits.conf,*/etc/*limits.d/*.conf setf limits " LambdaProlog (*.mod too, see Modsim) au BufNewFile,BufRead *.sig setf lprolog @@ -951,10 +992,10 @@ au BufNewFile,BufRead *.ld setf ld au BufNewFile,BufRead *.lex,*.l setf lex " Libao -au BufNewFile,BufRead /etc/libao.conf,*/.libao setf libao +au BufNewFile,BufRead */etc/libao.conf,*/.libao setf libao " Libsensors -au BufNewFile,BufRead /etc/sensors.conf setf sensors +au BufNewFile,BufRead */etc/sensors.conf,*/etc/sensors3.conf setf sensors " LFTP au BufNewFile,BufRead lftp.conf,.lftprc,*lftp/rc setf lftp @@ -963,7 +1004,7 @@ au BufNewFile,BufRead lftp.conf,.lftprc,*lftp/rc setf lftp au BufNewFile,BufRead *.ll setf lifelines " Lilo: Linux loader -au BufNewFile,BufRead lilo.conf* call s:StarSetf('lilo') +au BufNewFile,BufRead lilo.conf setf lilo " Lisp (*.el = ELisp, *.cl = Common Lisp, *.jl = librep Lisp) if has("fname_case") @@ -975,6 +1016,9 @@ endif " SBCL implementation of Common Lisp au BufNewFile,BufRead sbclrc,.sbclrc setf lisp +" Liquid +au BufNewFile,BufRead *.liquid setf liquid + " Lite au BufNewFile,BufRead *.lite,*.lt setf lite @@ -985,10 +1029,10 @@ au BufNewFile,BufRead */LiteStep/*/*.rc setf litestep au BufNewFile,BufRead /etc/logcheck/*.d/* setf logcheck " Login access -au BufNewFile,BufRead /etc/login.access setf loginaccess +au BufNewFile,BufRead */etc/login.access setf loginaccess " Login defs -au BufNewFile,BufRead /etc/login.defs setf logindefs +au BufNewFile,BufRead */etc/login.defs setf logindefs " Logtalk au BufNewFile,BufRead *.lgt setf logtalk @@ -1019,7 +1063,7 @@ au BufNewFile,BufRead *.mgp setf mgp 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 aliases -au BufNewFile,BufRead /etc/mail/aliases,/etc/aliases setf mailaliases +au BufNewFile,BufRead */etc/mail/aliases,*/etc/aliases setf mailaliases " Mailcap configuration file au BufNewFile,BufRead .mailcap,mailcap setf mailcap @@ -1034,7 +1078,7 @@ au BufNewFile,BufRead *.ist,*.mst setf ist au BufNewFile,BufRead *.man setf man " Man config -au BufNewFile,BufRead /etc/man.conf,man.config setf manconf +au BufNewFile,BufRead */etc/man.conf,man.config setf manconf " Maple V au BufNewFile,BufRead *.mv,*.mpl,*.mws setf maple @@ -1042,6 +1086,9 @@ au BufNewFile,BufRead *.mv,*.mpl,*.mws setf maple " Map (UMN mapserver config file) au BufNewFile,BufRead *.map setf map +" Markdown +au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,README.md setf markdown + " Mason au BufNewFile,BufRead *.mason,*.mhtml setf mason @@ -1052,7 +1099,7 @@ func! s:FTm() let n = 1 while n < 10 let line = getline(n) - if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)' + if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\|//\)' setf objc return endif @@ -1079,8 +1126,11 @@ au BufNewFile,BufRead *.nb setf mma " Maya Extension Language au BufNewFile,BufRead *.mel setf mel -" Messages -au BufNewFile,BufRead /var/log/messages,/var/log/messages.*[0-9] setf messages +" Mercurial config (looks like generic config file) +au BufNewFile,BufRead *.hgrc,*hgrc setf cfg + +" Messages (logs mostly) +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]*} setf messages " Metafont au BufNewFile,BufRead *.mf setf mf @@ -1136,11 +1186,7 @@ au BufNewFile,BufRead *.isc,*.monk,*.ssc,*.tsc setf monk au BufNewFile,BufRead *.moo setf moo " Modconf -au BufNewFile,BufRead /etc/modules.conf,/etc/conf.modules setf modconf -au BufNewFile,BufRead /etc/modutils/* - \ if executable(expand("<afile>")) != 1 - \| call s:StarSetf('modconf') - \|endif +au BufNewFile,BufRead */etc/modules.conf,*/etc/modules,*/etc/conf.modules setf modconf " Mplayer config au BufNewFile,BufRead mplayer.conf,*/.mplayer/config setf mplayerconf @@ -1157,6 +1203,9 @@ au BufNewFile,BufRead *.msql setf msql " Mysql au BufNewFile,BufRead *.mysql setf mysql +" Mutt setup files (must be before catch *.rc) +au BufNewFile,BufRead */etc/Muttrc.d/* call s:StarSetf('muttrc') + " M$ Resource files au BufNewFile,BufRead *.rc setf rc @@ -1170,7 +1219,7 @@ au BufNewFile,BufRead *.mush setf mush au BufNewFile,BufRead Mutt{ng,}rc setf muttrc " Nano -au BufNewFile,BufRead /etc/nanorc,.nanorc setf nanorc +au BufNewFile,BufRead */etc/nanorc,.nanorc setf nanorc " Nastran input/DMAP "au BufNewFile,BufRead *.dat setf nastran @@ -1181,6 +1230,9 @@ au BufNewFile,BufRead *.NS[ACGLMNPS] setf natural " Netrc au BufNewFile,BufRead .netrc setf netrc +" Ninja file +au BufNewFile,BufRead *.ninja setf ninja + " Novell netware batch files au BufNewFile,BufRead *.ncf setf ncf @@ -1225,7 +1277,7 @@ au BufNewFile,BufRead *.nqc setf nqc au BufNewFile,BufRead *.nsi setf nsis " OCAML -au BufNewFile,BufRead *.ml,*.mli,*.mll,*.mly setf ocaml +au BufNewFile,BufRead *.ml,*.mli,*.mll,*.mly,.ocamlinit setf ocaml " Occam au BufNewFile,BufRead *.occ setf occam @@ -1246,13 +1298,13 @@ au BufNewFile,BufRead *.ora setf ora au BufNewFile,BufRead pf.conf setf pf " Pam conf -au BufNewFile,BufRead /etc/pam.conf setf pamconf +au BufNewFile,BufRead */etc/pam.conf setf pamconf " PApp au BufNewFile,BufRead *.papp,*.pxml,*.pxsl setf papp " Password file -au BufNewFile,BufRead /etc/passwd,/etc/passwd-,/etc/passwd.edit,/etc/shadow,/etc/shadow-,/var/backups/passwd.bak,/var/backups/shadow.bak setf passwd +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 " Pascal (also *.p) au BufNewFile,BufRead *.pas setf pascal @@ -1269,7 +1321,8 @@ if has("fname_case") else au BufNewFile,BufRead *.pl call s:FTpl() endif -au BufNewFile,BufRead *.plx setf perl +au BufNewFile,BufRead *.plx,*.al setf perl +au BufNewFile,BufRead *.p6,*.pm6 setf perl6 func! s:FTpl() if exists("g:filetype_pl") @@ -1381,6 +1434,10 @@ au BufNewFile,BufRead *.g setf pccts " PPWizard au BufNewFile,BufRead *.it,*.ih setf 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 *.pc setf proc @@ -1474,7 +1531,7 @@ au BufNewFile,BufRead *.pdb setf prolog au BufNewFile,BufRead *.pml setf promela " Protocols -au BufNewFile,BufRead /etc/protocols setf protocols +au BufNewFile,BufRead */etc/protocols setf protocols " Pyrex au BufNewFile,BufRead *.pyx,*.pxd setf pyrex @@ -1555,12 +1612,17 @@ func! s:FTr() endif endfor - " Nothing recognized, assume Rexx - setf rexx + " Nothing recognized, use user default or assume Rexx + if exists("g:filetype_r") + exe "setf " . g:filetype_r + else + " Rexx used to be the default, but R appears to be much more popular. + setf r + endif endfunc " Remind -au BufNewFile,BufRead .reminders* call s:StarSetf('remind') +au BufNewFile,BufRead .reminders,*.remind,*.rem setf remind " Resolv.conf au BufNewFile,BufRead resolv.conf setf resolv @@ -1587,7 +1649,16 @@ au BufNewFile,BufRead *.rtf setf rtf au BufNewFile,BufRead .irbrc,irbrc setf ruby " Ruby -au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec setf ruby +au BufNewFile,BufRead *.rb,*.rbw setf ruby + +" RubyGems +au BufNewFile,BufRead *.gemspec setf ruby + +" Rackup +au BufNewFile,BufRead *.ru setf ruby + +" Bundler +au BufNewFile,BufRead Gemfile setf ruby " Ruby on Rails au BufNewFile,BufRead *.builder,*.rxml,*.rjs setf ruby @@ -1595,7 +1666,7 @@ au BufNewFile,BufRead *.builder,*.rxml,*.rjs setf ruby " Rantfile and Rakefile is like Ruby au BufNewFile,BufRead [rR]antfile,*.rant,[rR]akefile,*.rake setf ruby -" S-lang (or shader language!) +" S-lang (or shader language, or SmallLisp) au BufNewFile,BufRead *.sl setf slang " Samba config @@ -1613,6 +1684,9 @@ au BufNewFile,BufRead *.sa setf sather " Scilab au BufNewFile,BufRead *.sci,*.sce setf scilab +" SCSS +au BufNewFile,BufRead *.scss setf scss + " SD: Streaming Descriptors au BufNewFile,BufRead *.sd setf sd @@ -1648,19 +1722,19 @@ func! s:McSetf() endfunc " Services -au BufNewFile,BufRead /etc/services setf services +au BufNewFile,BufRead */etc/services setf services " Service Location config -au BufNewFile,BufRead /etc/slp.conf setf slpconf +au BufNewFile,BufRead */etc/slp.conf setf slpconf " Service Location registration -au BufNewFile,BufRead /etc/slp.reg setf slpreg +au BufNewFile,BufRead */etc/slp.reg setf slpreg " Service Location SPI -au BufNewFile,BufRead /etc/slp.spi setf slpspi +au BufNewFile,BufRead */etc/slp.spi setf slpspi " Setserial config -au BufNewFile,BufRead /etc/serial.conf setf setserial +au BufNewFile,BufRead */etc/serial.conf setf setserial " SGML au BufNewFile,BufRead *.sgm,*.sgml @@ -1687,14 +1761,22 @@ au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog') " Gentoo ebuilds are actually bash scripts au 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)) +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 =~ '\<ksh\>' + 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 @@ -1762,9 +1844,9 @@ func! s:CSH() endfunc " Z-Shell script -au BufNewFile,BufRead .zprofile,/etc/zprofile,.zfbfmarks setf zsh +au BufNewFile,BufRead .zprofile,*/etc/zprofile,.zfbfmarks setf zsh au BufNewFile,BufRead .zsh*,.zlog*,.zcompdump* call s:StarSetf('zsh') -au BufNewFile,BufRead *.zsh setf zsh +au BufNewFile,BufRead *.zsh setf zsh " Scheme au BufNewFile,BufRead *.scm,*.ss setf scheme @@ -1832,10 +1914,15 @@ au BufNewFile,BufRead *.rules call s:FTRules() let s:ft_rules_udev_rules_pattern = '^\s*\cudev_rules\s*=\s*"\([^"]\{-1,}\)/*".*' func! s:FTRules() - if expand('<amatch>:p') =~ '^/etc/udev/\%(rules\.d/\)\=.*\.rules$' + let path = expand('<amatch>:p') + if path =~ '^/\(etc/udev/\%(rules\.d/\)\=.*\.rules\|lib/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/ @@ -1916,10 +2003,16 @@ au BufNewFile,BufRead *.sml setf sml au BufNewFile,BufRead *.cm setf voscm " Sysctl -au BufNewFile,BufRead /etc/sysctl.conf setf sysctl +au BufNewFile,BufRead */etc/sysctl.conf,*/etc/sysctl.d/*.conf setf sysctl + +" Synopsys Design Constraints +au BufNewFile,BufRead *.sdc setf sdc " Sudoers -au BufNewFile,BufRead /etc/sudoers,sudoers.tmp setf sudoers +au BufNewFile,BufRead */etc/sudoers,sudoers.tmp setf sudoers + +" SVG (Scalable Vector Graphics) +au BufNewFile,BufRead *.svg setf svg " If the file has an extension of 't' and is in a directory 't' then it is " almost certainly a Perl test file. @@ -1953,6 +2046,10 @@ au BufNewFile,BufRead tags setf tags " TAK au BufNewFile,BufRead *.tak setf tak +" Task +au BufRead,BufNewFile {pending,completed,undo}.data setf taskdata +au BufRead,BufNewFile *.task setf taskedit + " Tcl (JACL too) au BufNewFile,BufRead *.tcl,*.tk,*.itcl,*.itk,*.jacl setf tcl @@ -2039,6 +2136,9 @@ au BufNewFile,BufRead *.tf,.tfrc,tfrc setf tf " TPP - Text Presentation Program au BufNewFile,BufReadPost *.tpp setf tpp +" Treetop +au BufRead,BufNewFile *.treetop setf treetop + " Trustees au BufNewFile,BufRead trustees.conf setf trustees @@ -2055,19 +2155,23 @@ au BufNewFile,BufReadPost *.tsscl setf tsscl au BufNewFile,BufRead *.uit,*.uil setf uil " Udev conf -au BufNewFile,BufRead /etc/udev/udev.conf setf udevconf +au BufNewFile,BufRead */etc/udev/udev.conf setf udevconf " Udev permissions -au BufNewFile,BufRead /etc/udev/permissions.d/*.permissions setf udevperm +au BufNewFile,BufRead */etc/udev/permissions.d/*.permissions setf udevperm " " Udev symlinks config -au BufNewFile,BufRead /etc/udev/cdsymlinks.conf setf sh +au BufNewFile,BufRead */etc/udev/cdsymlinks.conf setf sh " UnrealScript au BufNewFile,BufRead *.uc setf uc " Updatedb -au BufNewFile,BufRead /etc/updatedb.conf setf updatedb +au BufNewFile,BufRead */etc/updatedb.conf setf updatedb + +" Upstart (init(8)) config files +au BufNewFile,BufRead */etc/init/*.conf,*/.init/*.conf setf upstart +au BufNewFile,BufRead */etc/init/*.override,*/.init/*.override setf upstart " Vera au BufNewFile,BufRead *.vr,*.vri,*.vrh setf vera @@ -2091,8 +2195,13 @@ au BufNewFile,BufRead *.vim,*.vba,.exrc,_exrc setf vim " Viminfo file au BufNewFile,BufRead .viminfo,_viminfo setf viminfo -" Virata Config Script File -au BufRead,BufNewFile *.hw,*.module,*.pkg setf virata +" Virata Config Script File or Drupal module +au BufRead,BufNewFile *.hw,*.module,*.pkg + \ if getline(1) =~ '<?php' | + \ setf php | + \ else | + \ setf virata | + \ endif " Visual Basic (also uses *.bas) or FORM au BufNewFile,BufRead *.frm call s:FTVB("form") @@ -2157,15 +2266,18 @@ au BufEnter *.xpm2 setf xpm2 " XFree86 config au BufNewFile,BufRead XF86Config \ if getline(1) =~ '\<XConfigurator\>' | - \ let b:xf86c_xfree86_version = 3 | + \ let b:xf86conf_xfree86_version = 3 | \ endif | \ setf xf86conf +au BufNewFile,BufRead */xorg.conf.d/*.conf + \ let b:xf86conf_xfree86_version = 4 | + \ setf xf86conf " Xorg config -au BufNewFile,BufRead xorg.conf,xorg.conf-4 let b:xf86c_xfree86_version = 4 | setf xf86conf +au BufNewFile,BufRead xorg.conf,xorg.conf-4 let b:xf86conf_xfree86_version = 4 | setf xf86conf " Xinetd conf -au BufNewFile,BufRead /etc/xinetd.conf setf xinetd +au BufNewFile,BufRead */etc/xinetd.conf setf xinetd " XS Perl extension interface language au BufNewFile,BufRead *.xs setf xs @@ -2212,7 +2324,7 @@ au BufNewFile,BufRead *.ts,*.ui setf xml au BufNewFile,BufRead *.tpm setf xml " Xdg menus -au BufNewFile,BufRead /etc/xdg/menus/*.menu setf xml +au BufNewFile,BufRead */etc/xdg/menus/*.menu setf xml " ATI graphics driver configuration au BufNewFile,BufRead fglrxrc setf xml @@ -2260,6 +2372,9 @@ endfunc " Yaml au BufNewFile,BufRead *.yaml,*.yml setf yaml +" yum conf (close enough to dosini) +au BufNewFile,BufRead */etc/yum.conf setf dosini + " Zope " dtml (zope dynamic template markup language), pt (zope page template), " cpt (zope form controller page template) @@ -2296,8 +2411,9 @@ au StdinReadPost * if !did_filetype() | runtime! scripts.vim | endif " 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') +" More Apache config files +au BufNewFile,BufRead access.conf*,apache.conf*,apache2.conf*,httpd.conf*,srm.conf* call s:StarSetf('apache') +au BufNewFile,BufRead */etc/apache2/*.conf*,*/etc/apache2/conf.*/*,*/etc/apache2/mods-*/*,*/etc/apache2/sites-*/*,*/etc/httpd/conf.d/*.conf* call s:StarSetf('apache') " Asterisk config file au BufNewFile,BufRead *asterisk/*.conf* call s:StarSetf('asterisk') @@ -2309,6 +2425,11 @@ au BufNewFile,BufRead bzr_log.* setf bzr " BIND zone au BufNewFile,BufRead */named/db.*,*/bind/db.* call s:StarSetf('bindzone') +" Calendar +au BufNewFile,BufRead */.calendar/*, + \*/share/calendar/*/calendar.*,*/share/calendar/calendar.* + \ call s:StarSetf('calendar') + " Changelog au BufNewFile,BufRead [cC]hange[lL]og* \ if getline(1) =~ '; urgency=' @@ -2318,10 +2439,10 @@ au BufNewFile,BufRead [cC]hange[lL]og* \|endif " Crontab -au BufNewFile,BufRead crontab,crontab.*,/etc/cron.d/* call s:StarSetf('crontab') +au BufNewFile,BufRead crontab,crontab.*,*/etc/cron.d/* call s:StarSetf('crontab') -" Debian Sources.list -au BufNewFile,BufRead /etc/apt/sources.list.d/* call s:StarSetf('debsources') +" dnsmasq(8) configuration +au BufNewFile,BufRead */etc/dnsmasq.d/* call s:StarSetf('dnsmasq') " Dracula au BufNewFile,BufRead drac.* call s:StarSetf('dracula') @@ -2337,6 +2458,9 @@ au BufNewFile,BufRead *fvwm2rc* \| let b:fvwm_version = 2 | call s:StarSetf('fvwm') \|endif +" Gedcom +au BufNewFile,BufRead */tmp/lltmp* call s:StarSetf('gedcom') + " GTK RC au BufNewFile,BufRead .gtkrc*,gtkrc* call s:StarSetf('gtkrc') @@ -2352,6 +2476,12 @@ au! BufNewFile,BufRead *jarg* " Kconfig au BufNewFile,BufRead Kconfig.* call s:StarSetf('kconfig') +" Lilo: Linux loader +au BufNewFile,BufRead lilo.conf* call s:StarSetf('lilo') + +" Logcheck +au BufNewFile,BufRead */etc/logcheck/*.d*/* call s:StarSetf('logcheck') + " Makefile au BufNewFile,BufRead [mM]akefile* call s:StarSetf('make') @@ -2362,7 +2492,11 @@ au BufNewFile,BufRead [rR]akefile* call s:StarSetf('ruby') au BufNewFile,BufRead mutt[[:alnum:]._-]\{6\} setf mail " Modconf -au BufNewFile,BufRead /etc/modprobe.* call s:StarSetf('modconf') +au BufNewFile,BufRead */etc/modutils/* + \ if executable(expand("<afile>")) != 1 + \| call s:StarSetf('modconf') + \|endif +au BufNewFile,BufRead */etc/modprobe.* call s:StarSetf('modconf') " Mutt setup file au BufNewFile,BufRead .mutt{ng,}rc*,*/.mutt{ng,}/mutt{ng,}rc* call s:StarSetf('muttrc') @@ -2372,7 +2506,7 @@ au BufNewFile,BufRead mutt{ng,}rc*,Mutt{ng,}rc* call s:StarSetf('muttrc') au BufNewFile,BufRead tmac.* call s:StarSetf('nroff') " Pam conf -au BufNewFile,BufRead /etc/pam.d/* call s:StarSetf('pamconf') +au BufNewFile,BufRead */etc/pam.d/* call s:StarSetf('pamconf') " Printcap and Termcap au BufNewFile,BufRead *printcap* @@ -2384,6 +2518,9 @@ au BufNewFile,BufRead *termcap* \| let b:ptcap_type = "term" | call s:StarSetf('ptcap') \|endif +" Remind +au BufNewFile,BufRead .reminders* call s:StarSetf('remind') + " Vim script au BufNewFile,BufRead *vimrc* call s:StarSetf('vim') @@ -2395,10 +2532,10 @@ au BufNewFile,BufRead Xresources*,*/app-defaults/*,*/Xresources/* call s:StarSet " XFree86 config au BufNewFile,BufRead XF86Config-4* - \ let b:xf86c_xfree86_version = 4 | call s:StarSetf('xf86conf') + \ let b:xf86conf_xfree86_version = 4 | call s:StarSetf('xf86conf') au BufNewFile,BufRead XF86Config* \ if getline(1) =~ '\<XConfigurator\>' - \| let b:xf86c_xfree86_version = 3 + \| let b:xf86conf_xfree86_version = 3 \|endif \|call s:StarSetf('xf86conf') @@ -2406,12 +2543,25 @@ au BufNewFile,BufRead XF86Config* au BufNewFile,BufRead *xmodmap* call s:StarSetf('xmodmap') " Xinetd conf -au BufNewFile,BufRead /etc/xinetd.d/* call s:StarSetf('xinetd') +au BufNewFile,BufRead */etc/xinetd.d/* call s:StarSetf('xinetd') + +" yum conf (close enough to dosini) +au BufNewFile,BufRead */etc/yum.repos.d/* call s:StarSetf('dosini') " Z-Shell script au BufNewFile,BufRead zsh*,zlog* call s:StarSetf('zsh') +" Plain text files, needs to be far down to not override others. This avoids +" the "conf" type being used if there is a line starting with '#'. +au BufNewFile,BufRead *.txt,*.text setf text + + +" Use the filetype detect plugins. They may overrule any of the previously +" detected filetypes. +runtime! ftdetect/*.vim + + " Generic configuration file (check this last, it's just guessing!) au BufNewFile,BufRead,StdinReadPost * \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat @@ -2420,10 +2570,6 @@ au BufNewFile,BufRead,StdinReadPost * \ setf conf | \ endif -" Use the plugin-filetype checks last, they may overrule any of the previously -" detected filetypes. -runtime! ftdetect/*.vim - augroup END |