Add and fix tests from upstream vim

This commit is contained in:
Adam Stankiewicz
2020-10-14 23:01:53 +02:00
parent 3da600ac30
commit bbee246aae
24 changed files with 1788 additions and 301 deletions

View File

@@ -7,7 +7,7 @@ A collection of language packs for Vim.
> One to rule them all, one to find them, one to bring them all and in the darkness bind them.
- It **won't affect your startup time**, as scripts are loaded only on demand\*.
- It **installs and updates 120+ times faster** than the <!--Package Count-->591<!--/Package Count--> packages it consists of.
- It **installs and updates 120+ times faster** than the <!--Package Count-->593<!--/Package Count--> packages it consists of.
- It is more secure because scripts loaded for all extensions are generated by vim-polyglot (ftdetect).
- Solid syntax and indentation support (other features skipped). Only the best language packs.
- All unnecessary files are ignored (like enormous documentation from php support).
@@ -163,7 +163,6 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr
- [rst](https://github.com/marshallward/vim-restructuredtext)
- [ruby](https://github.com/vim-ruby/vim-ruby)
- [rust](https://github.com/rust-lang/rust.vim)
- [sbt](https://github.com/derekwyatt/vim-sbt)
- [scala](https://github.com/derekwyatt/vim-scala)
- [scss](https://github.com/cakebaker/scss-syntax.vim)
- [sh](https://github.com/arzg/vim-sh)

View File

@@ -4,7 +4,10 @@ set cpo&vim
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
func! polyglot#detect#Inp()
func! polyglot#detect#Inp(...)
if a:0 != 1 && did_filetype()
return
endif
let line = getline(nextnonblank(1))
if line =~# '^\*'
set ft=abaqus | return
@@ -17,14 +20,20 @@ func! polyglot#detect#Inp()
endfor
endfunc
func! polyglot#detect#Asa()
func! polyglot#detect#Asa(...)
if a:0 != 1 && did_filetype()
return
endif
if exists("g:filetype_asa")
let &ft = g:filetype_asa | return
endif
set ft=aspvbs | return
endfunc
func! polyglot#detect#Asp()
func! polyglot#detect#Asp(...)
if a:0 != 1 && did_filetype()
return
endif
if exists("g:filetype_asp")
let &ft = g:filetype_asp | return
endif
@@ -37,7 +46,10 @@ func! polyglot#detect#Asp()
set ft=aspvbs | return
endfunc
func! polyglot#detect#H()
func! polyglot#detect#H(...)
if a:0 != 1 && did_filetype()
return
endif
for lnum in range(1, min([line("$"), 200]))
let line = getline(lnum)
if line =~# '^\s*\(@\(interface\|class\|protocol\|property\|end\|synchronised\|selector\|implementation\)\(\<\|\>\)\|#import\s\+.\+\.h[">]\)'
@@ -56,7 +68,10 @@ func! polyglot#detect#H()
set ft=cpp | return
endfunc
func! polyglot#detect#M()
func! polyglot#detect#M(...)
if a:0 != 1 && did_filetype()
return
endif
let saw_comment = 0
for lnum in range(1, min([line("$"), 100]))
let line = getline(lnum)
@@ -85,7 +100,10 @@ func! polyglot#detect#M()
set ft=octave | return
endfunc
func! polyglot#detect#Fs()
func! polyglot#detect#Fs(...)
if a:0 != 1 && did_filetype()
return
endif
for lnum in range(1, min([line("$"), 50]))
let line = getline(lnum)
if line =~# '^\(: \|new-device\)'
@@ -104,7 +122,10 @@ func! polyglot#detect#Fs()
set ft=forth | return
endfunc
func! polyglot#detect#Re()
func! polyglot#detect#Re(...)
if a:0 != 1 && did_filetype()
return
endif
for lnum in range(1, min([line("$"), 50]))
let line = getline(lnum)
if line =~# '^\s*#\%(\%(if\|ifdef\|define\|pragma\)\s\+\w\|\s*include\s\+[<"]\|template\s*<\)'
@@ -114,7 +135,10 @@ func! polyglot#detect#Re()
endfor
endfunc
func! polyglot#detect#Idr()
func! polyglot#detect#Idr(...)
if a:0 != 1 && did_filetype()
return
endif
for lnum in range(1, min([line("$"), 5]))
let line = getline(lnum)
if line =~# '^\s*--.*[Ii]dris \=1'
@@ -148,7 +172,10 @@ func! polyglot#detect#Idr()
set ft=idris2 | return
endfunc
func! polyglot#detect#Lidr()
func! polyglot#detect#Lidr(...)
if a:0 != 1 && did_filetype()
return
endif
for lnum in range(1, min([line("$"), 200]))
let line = getline(lnum)
if line =~# '^>\s*--.*[Ii]dris \=1'
@@ -158,7 +185,10 @@ func! polyglot#detect#Lidr()
set ft=lidris2 | return
endfunc
func! polyglot#detect#Bas()
func! polyglot#detect#Bas(...)
if a:0 != 1 && did_filetype()
return
endif
for lnum in range(1, min([line("$"), 5]))
let line = getline(lnum)
if line =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
@@ -168,7 +198,10 @@ func! polyglot#detect#Bas()
set ft=basic | return
endfunc
func! polyglot#detect#Pm()
func! polyglot#detect#Pm(...)
if a:0 != 1 && did_filetype()
return
endif
let line = getline(nextnonblank(1))
if line =~# 'XPM2'
set ft=xpm2 | return
@@ -192,7 +225,10 @@ func! polyglot#detect#Pm()
set ft=perl | return
endfunc
func! polyglot#detect#Pl()
func! polyglot#detect#Pl(...)
if a:0 != 1 && did_filetype()
return
endif
let line = getline(nextnonblank(1))
if line =~# '^[^#]*:-' || line =~# '^\s*\%(%\|/\*\)' || line =~# '\.\s*$'
set ft=prolog | return
@@ -213,7 +249,10 @@ func! polyglot#detect#Pl()
set ft=perl | return
endfunc
func! polyglot#detect#T()
func! polyglot#detect#T(...)
if a:0 != 1 && did_filetype()
return
endif
for lnum in range(1, min([line("$"), 5]))
let line = getline(lnum)
if line =~# '^\.'
@@ -236,7 +275,10 @@ func! polyglot#detect#T()
set ft=perl | return
endfunc
func! polyglot#detect#Tt2()
func! polyglot#detect#Tt2(...)
if a:0 != 1 && did_filetype()
return
endif
for lnum in range(1, min([line("$"), 3]))
let line = getline(lnum)
if line =~? '<\%(!DOCTYPE HTML\|[%?]\|html\)'
@@ -246,7 +288,10 @@ func! polyglot#detect#Tt2()
set ft=tt2 | return
endfunc
func! polyglot#detect#Html()
func! polyglot#detect#Html(...)
if a:0 != 1 && did_filetype()
return
endif
let line = getline(nextnonblank(1))
if line =~# '^\(%\|<[%&].*>\)'
set ft=mason | return

View File

@@ -513,7 +513,6 @@ let s:interpreters = {
\ 'pdksh': 'sh',
\ 'rc': 'sh',
\ 'sh': 'sh',
\ 'zsh': 'sh',
\ 'boolector': 'smt2',
\ 'cvc4': 'smt2',
\ 'mathsat5': 'smt2',
@@ -526,6 +525,7 @@ let s:interpreters = {
\ 'z3': 'smt2',
\ 'deno': 'typescript',
\ 'ts-node': 'typescript',
\ 'zsh': 'zsh',
\ }
" DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE

View File

@@ -1,6 +1,5 @@
let s:globs = {
\ '8th': '*.8th',
\ 'Dockerfile': '*.dockerfile,*.dock,*.Dockerfile,Dockerfile,dockerfile,Dockerfile*',
\ 'Jenkinsfile': '*.jenkinsfile,*.Jenkinsfile,Jenkinsfile,Jenkinsfile*',
\ 'a2ps': 'a2psrc,.a2psrc',
\ 'a65': '*.a65',
@@ -35,7 +34,7 @@ let s:globs = {
\ 'atlas': '*.atl,*.as',
\ 'autohotkey': '*.ahk,*.ahkl',
\ 'autoit': '*.au3',
\ 'automake': '*.mak,*.dsp,*.mk,Makefile.am,makefile.am,GNUmakefile.am',
\ 'automake': '[mM]akefile.am,GNUmakefile.am',
\ 'ave': '*.ave',
\ 'awk': '*.awk,*.gawk',
\ 'b': '*.mch,*.ref,*.imp',
@@ -203,7 +202,7 @@ let s:globs = {
\ 'gtkrc': '.gtkrc,gtkrc,.gtkrc*,gtkrc*',
\ 'haml': '*.haml,*.haml.deface,*.hamlc,*.hamlbars',
\ 'hamster': '*.hsc,*.hsm',
\ 'haproxy': '*.cfg,haproxy.cfg,haproxy*.conf*',
\ 'haproxy': 'haproxy*.conf*,haproxy*.cfg*',
\ 'haskell': '*.hs,*.hs-boot,*.hsc,*.bpk,*.hsig',
\ 'haste': '*.ht',
\ 'hastepreproc': '*.htpp',
@@ -305,6 +304,7 @@ let s:globs = {
\ 'mail': '*.eml,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,{neo,}mutt[[:alnum:]._-]\\\{6\},reportbug-*',
\ 'mailaliases': '',
\ 'mailcap': '.mailcap,mailcap',
\ 'make': '*.mak,*.dsp,*.mk,*[mM]akefile',
\ 'mako': '*.mako,*.mao',
\ 'mallard': '*.page',
\ 'manconf': 'man.config',
@@ -374,7 +374,7 @@ let s:globs = {
\ 'pamconf': '',
\ 'pamenv': 'pam_env.conf,.pam_environment',
\ 'papp': '*.papp,*.pxml,*.pxsl',
\ 'pascal': '*.pas,*.dpr',
\ 'pascal': '*.pas,*.pp,*.dpr,*.lpr',
\ 'passwd': '',
\ 'pccts': '*.g',
\ 'pcmk': '*.pcmk',
@@ -455,7 +455,7 @@ let s:globs = {
\ 'sas': '*.sas',
\ 'sass': '*.sass',
\ 'sather': '*.sa',
\ 'sbt.scala': '*.sbt',
\ 'sbt': '*.sbt',
\ 'scala': '*.scala,*.kojo,*.sc',
\ 'scheme': '*.scm,*.ss,*.rkt',
\ 'scilab': '*.sci,*.sce',
@@ -469,7 +469,7 @@ let s:globs = {
\ 'services': '',
\ 'setserial': '',
\ 'sexplib': '*.sexp',
\ 'sh': '*.sh,*.bash,*.bats,*.cgi,*.command,*.env,*.fcgi,*.ksh,*.sh.in,*.tmux,*.tool,.bash_aliases,.bash_history,.bash_logout,.bash_profile,.bashrc,.cshrc,.env,.env.example,.flaskenv,.login,.profile,9fs,PKGBUILD,bash_aliases,bash_logout,bash_profile,bashrc,cshrc,gradlew,login,man,profile,zlogin,zlogout,zprofile,zshenv,zshrc',
\ 'sh': '*.sh,*.bash,*.bats,*.cgi,*.command,*.env,*.fcgi,*.ksh,*.sh.in,*.tmux,*.tool,.bash_aliases,.bash_history,.bash_logout,.bash_profile,.bashrc,.cshrc,.env,.env.example,.flaskenv,.login,.profile,9fs,PKGBUILD,bash_aliases,bash_logout,bash_profile,bashrc,cshrc,gradlew,login,man,profile',
\ 'sieve': '*.siv,*.sieve',
\ 'sil': '*.sil',
\ 'simula': '*.sim',
@@ -536,7 +536,7 @@ let s:globs = {
\ 'textile': '*.textile',
\ 'tf': '*.tf,.tfrc,tfrc',
\ 'thrift': '*.thrift',
\ 'tidy': '.tidyrc,tidyrc',
\ 'tidy': '.tidyrc,tidyrc,tidy.conf',
\ 'tilde': '*.t.html',
\ 'tli': '*.tli',
\ 'tmux': '.tmux*.conf',
@@ -594,6 +594,7 @@ let s:globs = {
\ 'wvdial': 'wvdial.conf,.wvdialrc',
\ 'xdc': '*.xdc',
\ 'xdefaults': '*.ad,.Xdefaults,.Xpdefaults,.Xresources,xdm-config,Xresources*',
\ 'xf86conf': 'XF86Config-4*,XF86Config*,xorg.conf,xorg.conf-4',
\ 'xhtml': '*.xhtml,*.xht',
\ 'xinetd': '',
\ 'xmath': '*.msc,*.msf',

View File

@@ -27,6 +27,9 @@ let did_load_filetypes = 1
let s:cpo_save = &cpo
set cpo&vim
" Be consistent across different systems
set nofileignorecase
func! s:Observe(fn)
let b:polyglot_observe = a:fn
augroup polyglot-observer
@@ -118,9 +121,10 @@ augroup filetypedetect
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
if !has_key(s:disabled_packages, 'html')
au! BufNewFile,BufRead,BufWritePost *.html call polyglot#detect#Html()
au BufNewFile,BufRead *.htm,*.html.hl,*.inc,*.st,*.xht,*.xhtml setf html
if !has_key(s:disabled_packages, 'xf86conf')
au BufNewFile,BufRead */xorg.conf.d/*.conf,xorg.conf,xorg.conf-4 setf xf86conf
au BufNewFile,BufRead XF86Config-4* call s:StarSetf('xf86conf')
au BufNewFile,BufRead XF86Config* call s:StarSetf('xf86conf')
endif
if !has_key(s:disabled_packages, 'pullrequest')
@@ -351,7 +355,7 @@ if !has_key(s:disabled_packages, 'tpp')
endif
if !has_key(s:disabled_packages, 'tidy')
au BufNewFile,BufRead {.,}tidyrc,tidyrc setf tidy
au BufNewFile,BufRead {.,}tidyrc,tidy.conf,tidyrc setf tidy
endif
if !has_key(s:disabled_packages, 'texmf')
@@ -563,10 +567,6 @@ if !has_key(s:disabled_packages, 'sieve')
au BufNewFile,BufRead *.sieve,*.siv setf sieve
endif
if !has_key(s:disabled_packages, 'sed')
au BufNewFile,BufRead *.sed setf sed
endif
if !has_key(s:disabled_packages, 'sdl')
au BufNewFile,BufRead *.pr,*.sdl setf sdl
endif
@@ -579,6 +579,10 @@ if !has_key(s:disabled_packages, 'scilab')
au BufNewFile,BufRead *.sce,*.sci setf scilab
endif
if !has_key(s:disabled_packages, 'sbt')
au BufNewFile,BufRead *.sbt setf sbt
endif
if !has_key(s:disabled_packages, 'sather')
au BufNewFile,BufRead *.sa setf sather
endif
@@ -781,7 +785,7 @@ if !has_key(s:disabled_packages, 'pdf')
endif
if !has_key(s:disabled_packages, 'pascal')
au BufNewFile,BufRead *.dpr,*.pas setf pascal
au BufNewFile,BufRead *.dpr,*.lpr,*.pas,*.pp setf pascal
endif
if !has_key(s:disabled_packages, 'passwd')
@@ -887,10 +891,6 @@ if !has_key(s:disabled_packages, 'muttrc')
au BufNewFile,BufRead */.mutt{ng,}/mutt{ng,}rc* call s:StarSetf('muttrc')
endif
if !has_key(s:disabled_packages, 'mysql')
au BufNewFile,BufRead *.mysql setf mysql
endif
if !has_key(s:disabled_packages, 'msql')
au BufNewFile,BufRead *.msql setf msql
endif
@@ -1242,6 +1242,11 @@ if !has_key(s:disabled_packages, 'tilde')
au BufNewFile,BufRead *.t.html setf tilde
endif
if !has_key(s:disabled_packages, 'html')
au BufNewFile,BufRead,BufWritePost *.html call polyglot#detect#Html()
au BufNewFile,BufRead *.htm,*.html.hl,*.inc,*.st,*.xht,*.xhtml setf html
endif
if !has_key(s:disabled_packages, 'hollywood')
au BufNewFile,BufRead *.hws setf hollywood
endif
@@ -1695,11 +1700,11 @@ if !has_key(s:disabled_packages, 'gitignore')
endif
if !has_key(s:disabled_packages, 'tads')
au! BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
au BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
endif
if !has_key(s:disabled_packages, 'prolog')
au! BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
au BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
au BufNewFile,BufRead *.pdb,*.pro,*.prolog,*.yap setf prolog
endif
@@ -1722,7 +1727,7 @@ if !has_key(s:disabled_packages, 'spec')
endif
if !has_key(s:disabled_packages, 'visual-basic')
au! BufNewFile,BufRead,BufWritePost *.bas call polyglot#detect#Bas()
au BufNewFile,BufRead,BufWritePost *.bas call polyglot#detect#Bas()
au BufNewFile,BufRead *.cls,*.ctl,*.dsm,*.frm,*.frx,*.sba,*.vba,*.vbs setf vb
endif
@@ -1731,7 +1736,7 @@ if !has_key(s:disabled_packages, 'basic')
endif
if !has_key(s:disabled_packages, 'trasys')
au! BufNewFile,BufRead,BufWritePost *.inp call polyglot#detect#Inp()
au BufNewFile,BufRead,BufWritePost *.inp call polyglot#detect#Inp()
endif
if !has_key(s:disabled_packages, 'zig')
@@ -1881,8 +1886,8 @@ if !has_key(s:disabled_packages, 'slim')
endif
if !has_key(s:disabled_packages, 'sh')
au BufNewFile,BufRead *.bash,*.bats,*.cgi,*.command,*.env,*.fcgi,*.ksh,*.sh,*.sh.in,*.tmux,*.tool,*/etc/udev/cdsymlinks.conf,{.,}bash_aliases,{.,}bash_history,{.,}bash_logout,{.,}bash_profile,{.,}bashrc,{.,}cshrc,{.,}env,{.,}env.example,{.,}flaskenv,{.,}login,{.,}profile,9fs,PKGBUILD,bash_aliases,bash_logout,bash_profile,bashrc,cshrc,gradlew,login,man,profile,zlogin,zlogout,zprofile,zshenv,zshrc setf sh
au BufNewFile,BufRead *.zsh,{.,}zfbfmarks,{.,}zlogin,{.,}zlogout,{.,}zprofile,{.,}zshenv,{.,}zshrc setf zsh
au BufNewFile,BufRead *.bash,*.bats,*.cgi,*.command,*.env,*.fcgi,*.ksh,*.sh,*.sh.in,*.tmux,*.tool,*/etc/udev/cdsymlinks.conf,{.,}bash_aliases,{.,}bash_history,{.,}bash_logout,{.,}bash_profile,{.,}bashrc,{.,}cshrc,{.,}env,{.,}env.example,{.,}flaskenv,{.,}login,{.,}profile,9fs,PKGBUILD,bash_aliases,bash_logout,bash_profile,bashrc,cshrc,gradlew,login,man,profile setf sh
au BufNewFile,BufRead *.zsh,*/etc/zprofile,{.,}zfbfmarks,{.,}zlogin,{.,}zlogout,{.,}zprofile,{.,}zshenv,{.,}zshrc setf zsh
au BufNewFile,BufRead .zsh* call s:StarSetf('zsh')
au BufNewFile,BufRead .zlog* call s:StarSetf('zsh')
au BufNewFile,BufRead .zcompdump* call s:StarSetf('zsh')
@@ -1892,10 +1897,6 @@ if !has_key(s:disabled_packages, 'scss')
au BufNewFile,BufRead *.scss setf scss
endif
if !has_key(s:disabled_packages, 'sbt')
au BufNewFile,BufRead *.sbt setf sbt.scala
endif
if !has_key(s:disabled_packages, 'scala')
au BufNewFile,BufRead *.kojo,*.sc,*.scala setf scala
endif
@@ -1923,7 +1924,7 @@ if !has_key(s:disabled_packages, 'rst')
endif
if !has_key(s:disabled_packages, 'reason')
au! BufNewFile,BufRead,BufWritePost *.re call polyglot#detect#Re()
au BufNewFile,BufRead,BufWritePost *.re call polyglot#detect#Re()
au BufNewFile,BufRead *.rei setf reason
endif
@@ -1936,9 +1937,9 @@ if !has_key(s:disabled_packages, 'raml')
endif
if !has_key(s:disabled_packages, 'raku')
au! BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
au! BufNewFile,BufRead,BufWritePost *.pm call polyglot#detect#Pm()
au! BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
au BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
au BufNewFile,BufRead,BufWritePost *.pm call polyglot#detect#Pm()
au BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
au BufNewFile,BufRead *.6pl,*.6pm,*.nqp,*.p6,*.p6l,*.p6m,*.pl6,*.pm6,*.pod6,*.raku,*.rakudoc,*.rakumod,*.rakutest,*.t6 setf raku
endif
@@ -2018,14 +2019,14 @@ if !has_key(s:disabled_packages, 'pgsql')
endif
if !has_key(s:disabled_packages, 'perl')
au! BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
au! BufNewFile,BufRead,BufWritePost *.pm call polyglot#detect#Pm()
au! BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
au BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
au BufNewFile,BufRead,BufWritePost *.pm call polyglot#detect#Pm()
au BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
au BufNewFile,BufRead *.al,*.cgi,*.fcgi,*.perl,*.ph,*.plx,*.psgi,{.,}gitolite.rc,Makefile.PL,Rexfile,ack,cpanfile,example.gitolite.rc setf perl
au BufNewFile,BufRead *.pod setf pod
au BufNewFile,BufRead *.comp,*.mason,*.mhtml setf mason
au! BufNewFile,BufRead,BufWritePost *.tt2 call polyglot#detect#Tt2()
au! BufNewFile,BufRead,BufWritePost *.tt2 call polyglot#detect#Tt2()
au BufNewFile,BufRead,BufWritePost *.tt2 call polyglot#detect#Tt2()
au BufNewFile,BufRead,BufWritePost *.tt2 call polyglot#detect#Tt2()
au BufNewFile,BufRead *.xs setf xs
endif
@@ -2038,7 +2039,7 @@ if !has_key(s:disabled_packages, 'opencl')
endif
if !has_key(s:disabled_packages, 'octave')
au! BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
au BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
au BufNewFile,BufRead *.oct setf octave
endif
@@ -2055,8 +2056,8 @@ if !has_key(s:disabled_packages, 'ocaml')
endif
if !has_key(s:disabled_packages, 'objc')
au! BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
au! BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
au BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
au BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
endif
if !has_key(s:disabled_packages, 'nix')
@@ -2074,7 +2075,7 @@ if !has_key(s:disabled_packages, 'nginx')
endif
if !has_key(s:disabled_packages, 'murphi')
au! BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
au BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
endif
if !has_key(s:disabled_packages, 'moonscript')
@@ -2090,12 +2091,8 @@ if !has_key(s:disabled_packages, 'mdx')
au BufNewFile,BufRead *.mdx setf markdown.mdx
endif
if !has_key(s:disabled_packages, 'markdown')
au BufNewFile,BufRead *.markdown,*.md,*.mdown,*.mdwn,*.mkd,*.mkdn,*.mkdown,*.ronn,*.workbook,contents.lr setf markdown
endif
if !has_key(s:disabled_packages, 'mathematica')
au! BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
au BufNewFile,BufRead,BufWritePost *.m call polyglot#detect#M()
au BufNewFile,BufRead *.cdf,*.ma,*.mathematica,*.mma,*.mt,*.nb,*.nbp,*.wl,*.wls,*.wlt setf mma
endif
@@ -2183,14 +2180,14 @@ if !has_key(s:disabled_packages, 'ion')
endif
if !has_key(s:disabled_packages, 'idris2')
au! BufNewFile,BufRead,BufWritePost *.idr call polyglot#detect#Idr()
au BufNewFile,BufRead,BufWritePost *.idr call polyglot#detect#Idr()
au BufNewFile,BufRead *.ipkg,idris-response setf idris2
au! BufNewFile,BufRead,BufWritePost *.lidr call polyglot#detect#Lidr()
au BufNewFile,BufRead,BufWritePost *.lidr call polyglot#detect#Lidr()
endif
if !has_key(s:disabled_packages, 'idris')
au! BufNewFile,BufRead,BufWritePost *.lidr call polyglot#detect#Lidr()
au! BufNewFile,BufRead,BufWritePost *.idr call polyglot#detect#Idr()
au BufNewFile,BufRead,BufWritePost *.lidr call polyglot#detect#Lidr()
au BufNewFile,BufRead,BufWritePost *.idr call polyglot#detect#Idr()
au BufNewFile,BufRead idris-response setf idris
endif
@@ -2218,6 +2215,11 @@ if !has_key(s:disabled_packages, 'haskell')
au BufNewFile,BufRead *.bpk,*.hs,*.hs-boot,*.hsc,*.hsig setf haskell
endif
if !has_key(s:disabled_packages, 'haproxy')
au BufNewFile,BufRead haproxy*.conf* call s:StarSetf('haproxy')
au BufNewFile,BufRead haproxy*.cfg* call s:StarSetf('haproxy')
endif
if !has_key(s:disabled_packages, 'handlebars')
au BufNewFile,BufRead *.hjs,*.hogan,*.hulk,*.mustache setf html.mustache
au BufNewFile,BufRead *.handlebars,*.hb,*.hbs,*.hdbs setf html.handlebars
@@ -2263,7 +2265,7 @@ if !has_key(s:disabled_packages, 'gmpl')
endif
if !has_key(s:disabled_packages, 'glsl')
au! BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
au BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
au BufNewFile,BufRead *.comp,*.fp,*.frag,*.frg,*.fsh,*.fshader,*.geo,*.geom,*.glsl,*.glslf,*.glslv,*.gs,*.gshader,*.shader,*.tesc,*.tese,*.vert,*.vrx,*.vsh,*.vshader setf glsl
endif
@@ -2280,12 +2282,12 @@ if !has_key(s:disabled_packages, 'gdscript')
endif
if !has_key(s:disabled_packages, 'fsharp')
au! BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
au BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
au BufNewFile,BufRead *.fsi,*.fsx setf fsharp
endif
if !has_key(s:disabled_packages, 'forth')
au! BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
au BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
au BufNewFile,BufRead *.ft,*.fth setf forth
endif
@@ -2327,8 +2329,6 @@ if !has_key(s:disabled_packages, 'elixir')
endif
if !has_key(s:disabled_packages, 'dockerfile')
au BufNewFile,BufRead *.Dockerfile,*.dock,*.dockerfile,Dockerfile,dockerfile setf Dockerfile
au BufNewFile,BufRead Dockerfile* call s:StarSetf('Dockerfile')
au BufNewFile,BufRead docker-compose*.yaml,docker-compose*.yml setf yaml.docker-compose
endif
@@ -2336,6 +2336,14 @@ if !has_key(s:disabled_packages, 'yaml')
au BufNewFile,BufRead *.mir,*.reek,*.rviz,*.sublime-syntax,*.syntax,*.yaml,*.yaml-tmlanguage,*.yaml.sed,*.yml,*.yml.mysql,{.,}clang-format,{.,}clang-tidy,{.,}gemrc,fish_history,fish_read_history,glide.lock,yarn.lock setf yaml
endif
if !has_key(s:disabled_packages, 'mysql')
au BufNewFile,BufRead *.mysql setf mysql
endif
if !has_key(s:disabled_packages, 'sed')
au BufNewFile,BufRead *.sed setf sed
endif
if !has_key(s:disabled_packages, 'dlang')
au BufNewFile,BufRead *.d,*.di setf d
au BufNewFile,BufRead *.lst setf dcov
@@ -2374,6 +2382,10 @@ if !has_key(s:disabled_packages, 'coffee-script')
au BufNewFile,BufRead *.coffee.md,*.litcoffee setf litcoffee
endif
if !has_key(s:disabled_packages, 'markdown')
au BufNewFile,BufRead *.markdown,*.md,*.mdown,*.mdwn,*.mkd,*.mkdn,*.mkdown,*.ronn,*.workbook,contents.lr setf markdown
endif
if !has_key(s:disabled_packages, 'cmake')
au BufNewFile,BufRead *.cmake,*.cmake.in,CMakeLists.txt setf cmake
endif
@@ -2407,12 +2419,12 @@ if !has_key(s:disabled_packages, 'atlas')
endif
if !has_key(s:disabled_packages, 'aspperl')
au! BufNewFile,BufRead,BufWritePost *.asp call polyglot#detect#Asp()
au BufNewFile,BufRead,BufWritePost *.asp call polyglot#detect#Asp()
endif
if !has_key(s:disabled_packages, 'aspvbs')
au! BufNewFile,BufRead,BufWritePost *.asp call polyglot#detect#Asp()
au! BufNewFile,BufRead,BufWritePost *.asa call polyglot#detect#Asa()
au BufNewFile,BufRead,BufWritePost *.asp call polyglot#detect#Asp()
au BufNewFile,BufRead,BufWritePost *.asa call polyglot#detect#Asa()
endif
if !has_key(s:disabled_packages, 'asn')
@@ -2420,13 +2432,17 @@ if !has_key(s:disabled_packages, 'asn')
endif
if !has_key(s:disabled_packages, 'automake')
au BufNewFile,BufRead *.dsp,*.mak,*.mk,GNUmakefile.am,Makefile.am,makefile.am setf automake
au BufNewFile,BufRead GNUmakefile.am,[mM]akefile.am setf automake
endif
if !has_key(s:disabled_packages, 'elf')
au BufNewFile,BufRead *.am setf elf
endif
if !has_key(s:disabled_packages, 'make')
au BufNewFile,BufRead *.dsp,*.mak,*.mk,*[mM]akefile setf make
endif
if !has_key(s:disabled_packages, 'autohotkey')
au BufNewFile,BufRead *.ahk,*.ahkl setf autohotkey
endif
@@ -2444,9 +2460,9 @@ if !has_key(s:disabled_packages, 'arduino')
endif
if !has_key(s:disabled_packages, 'c/c++')
au! BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
au BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
au BufNewFile,BufRead *.c++,*.cc,*.cp,*.cpp,*.cxx,*.h++,*.hh,*.hpp,*.hxx,*.inc,*.inl,*.ipp,*.moc,*.tcc,*.tlh,*.tpp setf cpp
au! BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
au BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
au BufNewFile,BufRead *.c,*.cats,*.idc,*.qc,*enlightenment/*.cfg setf c
endif
@@ -2506,6 +2522,14 @@ if !has_key(s:disabled_packages, 'alsaconf')
au BufNewFile,BufRead */etc/asound.conf,*/usr/share/alsa/alsa.conf,{.,}asoundrc setf alsaconf
endif
if !has_key(s:disabled_packages, 'conf')
au BufNewFile,BufRead *.conf,auto.master,config setf conf
endif
if !has_key(s:disabled_packages, 'master')
au BufNewFile,BufRead *.mas,*.master setf master
endif
if !has_key(s:disabled_packages, 'aidl')
" AIDL
au BufNewFile,BufRead *.aidl setf aidl
@@ -2541,7 +2565,7 @@ if !has_key(s:disabled_packages, 'abc')
endif
if !has_key(s:disabled_packages, 'abaqus')
au! BufNewFile,BufRead,BufWritePost *.inp call polyglot#detect#Inp()
au BufNewFile,BufRead,BufWritePost *.inp call polyglot#detect#Inp()
endif
if !has_key(s:disabled_packages, 'abap')
@@ -2563,19 +2587,6 @@ if !has_key(s:disabled_packages, 'a2ps')
au BufNewFile,BufRead */etc/a2ps.cfg,*/etc/a2ps/*.cfg,{.,}a2psrc,a2psrc setf a2ps
endif
if !has_key(s:disabled_packages, 'haproxy')
au BufNewFile,BufRead *.cfg,haproxy.cfg setf haproxy
au BufNewFile,BufRead haproxy*.conf* call s:StarSetf('haproxy')
endif
if !has_key(s:disabled_packages, 'conf')
au BufNewFile,BufRead *.conf,auto.master,config setf conf
endif
if !has_key(s:disabled_packages, 'master')
au BufNewFile,BufRead *.mas,*.master setf master
endif
if !has_key(s:disabled_packages, 'cfg')
au BufNewFile,BufRead *.cfg,*.hgrc,*hgrc setf cfg
endif
@@ -3635,9 +3646,6 @@ au BufNewFile,BufRead *.mod
\ setf modsim3 |
\ endif
" Modula 2 (.md removed in favor of Markdown)
au BufNewFile,BufRead *.m2,*.DEF,*.MOD,*.mi setf modula2
" Modula 3 (.m3, .i3, .mg, .ig)
au BufNewFile,BufRead *.[mi][3g] setf modula3
@@ -3950,13 +3958,6 @@ au BufNewFile,BufRead *.rego setf rego
" Rexx
au BufNewFile,BufRead *.rex,*.orx,*.rxo,*.rxj,*.jrexx,*.rexxj,*.rexx,*.testGroup,*.testUnit setf rexx
" R (Splus)
if has("fname_case")
au BufNewFile,BufRead *.s,*.S setf r
else
au BufNewFile,BufRead *.s setf r
endif
" R Help file
if has("fname_case")
au BufNewFile,BufRead *.rd,*.Rd setf rhelp

3
ftoff.vim Normal file
View File

@@ -0,0 +1,3 @@
if exists("did_load_polyglot")
unlet did_load_polyglot
endif

View File

@@ -1,37 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dockerfile') == -1
" Define comment string
setlocal commentstring=#\ %s
" Enable automatic comment insertion
setlocal formatoptions+=cro
function! DockerfileReplaceInstruction(original, replacement)
let syn = synIDtrans(synID(line("."), col(".") - 1, 0))
if syn != hlID("Comment") && syn != hlID("Constant") && strlen(getline(".")) == 0
let word = a:replacement
else
let word = a:original
endif
let g:UnduBuffer = a:original
return word
endfunction
inoreabbr <silent> <buffer> from <C-R>=DockerfileReplaceInstruction("from", "FROM")<CR>
inoreabbr <silent> <buffer> maintainer <C-R>=DockerfileReplaceInstruction("maintainer", "MAINTAINER")<CR>
inoreabbr <silent> <buffer> run <C-R>=DockerfileReplaceInstruction("run", "RUN")<CR>
inoreabbr <silent> <buffer> cmd <C-R>=DockerfileReplaceInstruction("cmd", "CMD")<CR>
inoreabbr <silent> <buffer> label <C-R>=DockerfileReplaceInstruction("label", "LABEL")<CR>
inoreabbr <silent> <buffer> expose <C-R>=DockerfileReplaceInstruction("expose", "EXPOSE")<CR>
inoreabbr <silent> <buffer> env <C-R>=DockerfileReplaceInstruction("env", "ENV")<CR>
inoreabbr <silent> <buffer> add <C-R>=DockerfileReplaceInstruction("add", "ADD")<CR>
inoreabbr <silent> <buffer> copy <C-R>=DockerfileReplaceInstruction("copy", "COPY")<CR>
inoreabbr <silent> <buffer> entrypoint <C-R>=DockerfileReplaceInstruction("entrypoint", "ENTRYPOINT")<CR>
inoreabbr <silent> <buffer> volume <C-R>=DockerfileReplaceInstruction("volume", "VOLUME")<CR>
inoreabbr <silent> <buffer> user <C-R>=DockerfileReplaceInstruction("user", "USER")<CR>
inoreabbr <silent> <buffer> workdir <C-R>=DockerfileReplaceInstruction("workdir", "WORKDIR")<CR>
inoreabbr <silent> <buffer> arg <C-R>=DockerfileReplaceInstruction("arg", "ARG")<CR>
inoreabbr <silent> <buffer> onbuild <C-R>=DockerfileReplaceInstruction("onbuild", "ONBUILD")<CR>
inoreabbr <silent> <buffer> stopsignal <C-R>=DockerfileReplaceInstruction("stopsignal", "STOPSIGNAL")<CR>
endif

37
ftplugin/make.vim Normal file
View File

@@ -0,0 +1,37 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'make') == -1
" Vim filetype plugin file
" Language: Make
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2019 Apr 02
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
let b:undo_ftplugin = "setl et< sts< fo< com< cms< inc<"
" Make sure a hard tab is used, required for most make programs
setlocal noexpandtab softtabstop=0
" Set 'formatoptions' to break comment lines but not other lines,
" and insert the comment leader when hitting <CR> or using "o".
setlocal fo-=t fo+=croql
" Set 'comments' to format dashed lists in comments
setlocal com=sO:#\ -,mO:#\ \ ,b:#
" Set 'commentstring' to put the marker after a #.
setlocal commentstring=#\ %s
" Including files.
let &l:include = '^\s*include'
" For matchit.vim, suggested by Albert Netymk and Ken Takata.
if exists("loaded_matchit")
let b:match_words = '^ *ifn\=\(eq\|def\)\>:^ *else\(\s\+ifn\=\(eq\|def\)\)\=\>:^ *endif\>,\<define\>:\<endef\>,^!\s*if\(n\=def\)\=\>:^!\s*else\(if\(n\=def\)\=\)\=\>:^!\s*endif\>'
endif
endif

19
ftplugin/sbt.vim Normal file
View File

@@ -0,0 +1,19 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'sbt') == -1
" Vim filetype plugin file
" Language: sbt
" Maintainer: Steven Dobay <stevendobay at protonmail.com>
" License: Same as Vim
" Last Change: 2017.04.30
" ----------------------------------------------------------------------------
if exists('b:did_ftplugin') || &cp
finish
endif
let b:did_ftplugin = 1
runtime! ftplugin/scala.vim
endif

23
ftplugin/xf86conf.vim Normal file
View File

@@ -0,0 +1,23 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'xf86conf') == -1
" Vim filetype plugin file
" Language: XFree86 Configuration File
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2008-07-09
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
let b:undo_ftplugin = "setl com< cms< fo<"
setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql
let &cpo = s:cpo_save
unlet s:cpo_save
endif

View File

@@ -1,27 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dockerfile') == -1
if exists('b:did_indent') | finish | endif
let b:did_indent = 1
function! DockerfileIndent(line)
let prev_line = getline(a:line - 1)
if a:line > 1 && prev_line =~ '\\\s*$'
let i = indent(a:line - 1)
if i == 0
let i += &l:shiftwidth
if &l:expandtab && prev_line =~# '^RUN\s'
" Overindent past RUN
let i = 4 + &l:shiftwidth
endif
endif
return i
endif
return -1
endfunction
set indentexpr=DockerfileIndent(v:lnum)
endif

120
indent/make.vim Normal file
View File

@@ -0,0 +1,120 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'make') == -1
" Vim indent file
" Language: Makefile
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2007-05-07
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetMakeIndent()
setlocal indentkeys=!^F,o,O,<:>,=else,=endif
setlocal nosmartindent
if exists("*GetMakeIndent")
finish
endif
let s:comment_rx = '^\s*#'
let s:rule_rx = '^[^ \t#:][^#:]*:\{1,2}\%([^=:]\|$\)'
let s:continued_rule_rx = '^[^#:]*:\{1,2}\%([^=:]\|$\)'
let s:continuation_rx = '\\$'
let s:assignment_rx = '^\s*\h\w*\s*[+?]\==\s*\zs.*\\$'
let s:folded_assignment_rx = '^\s*\h\w*\s*[+?]\=='
" TODO: This needs to be a lot more restrictive in what it matches.
let s:just_inserted_rule_rx = '^\s*[^#:]\+:\{1,2}$'
let s:conditional_directive_rx = '^ *\%(ifn\=\%(eq\|def\)\|else\)\>'
let s:end_conditional_directive_rx = '^\s*\%(else\|endif\)\>'
function s:remove_continuation(line)
return substitute(a:line, s:continuation_rx, "", "")
endfunction
function GetMakeIndent()
" TODO: Should this perhaps be v:lnum -1?
" let prev_lnum = prevnonblank(v:lnum - 1)
let prev_lnum = v:lnum - 1
if prev_lnum == 0
return 0
endif
let prev_line = getline(prev_lnum)
let prev_prev_lnum = prev_lnum - 1
let prev_prev_line = prev_prev_lnum != 0 ? getline(prev_prev_lnum) : ""
" TODO: Deal with comments. In comments, continuations aren't interesting.
if prev_line =~ s:continuation_rx
if prev_prev_line =~ s:continuation_rx
return indent(prev_lnum)
elseif prev_line =~ s:rule_rx
return shiftwidth()
elseif prev_line =~ s:assignment_rx
call cursor(prev_lnum, 1)
if search(s:assignment_rx, 'W') != 0
return virtcol('.') - 1
else
" TODO: ?
return shiftwidth()
endif
else
" TODO: OK, this might be a continued shell command, so perhaps indent
" properly here? Leave this out for now, but in the next release this
" should be using indent/sh.vim somehow.
"if prev_line =~ '^\t' " s:rule_command_rx
" if prev_line =~ '^\s\+[@-]\%(if\)\>'
" return indent(prev_lnum) + 2
" endif
"endif
return indent(prev_lnum) + shiftwidth()
endif
elseif prev_prev_line =~ s:continuation_rx
let folded_line = s:remove_continuation(prev_prev_line) . ' ' . s:remove_continuation(prev_line)
let lnum = prev_prev_lnum - 1
let line = getline(lnum)
while line =~ s:continuation_rx
let folded_line = s:remove_continuation(line) . ' ' . folded_line
let lnum -= 1
let line = getline(lnum)
endwhile
let folded_lnum = lnum + 1
if folded_line =~ s:rule_rx
if getline(v:lnum) =~ s:rule_rx
return 0
else
return &ts
endif
else
" elseif folded_line =~ s:folded_assignment_rx
if getline(v:lnum) =~ s:rule_rx
return 0
else
return indent(folded_lnum)
endif
" else
" " TODO: ?
" return indent(prev_lnum)
endif
elseif prev_line =~ s:rule_rx
if getline(v:lnum) =~ s:rule_rx
return 0
else
return &ts
endif
elseif prev_line =~ s:conditional_directive_rx
return shiftwidth()
else
let line = getline(v:lnum)
if line =~ s:just_inserted_rule_rx
return 0
elseif line =~ s:end_conditional_directive_rx
return v:lnum - 1 == 0 ? 0 : indent(v:lnum - 1) - shiftwidth()
else
return v:lnum - 1 == 0 ? 0 : indent(v:lnum - 1)
endif
endif
endfunction
endif

41
indent/xf86conf.vim Normal file
View File

@@ -0,0 +1,41 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'xf86conf') == -1
" Vim indent file
" Language: XFree86 Configuration File
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2006-12-20
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetXF86ConfIndent()
setlocal indentkeys=!^F,o,O,=End
setlocal nosmartindent
if exists("*GetXF86ConfIndent")
finish
endif
function GetXF86ConfIndent()
let lnum = prevnonblank(v:lnum - 1)
if lnum == 0
return 0
endif
let ind = indent(lnum)
if getline(lnum) =~? '^\s*\(Sub\)\=Section\>'
let ind = ind + shiftwidth()
endif
if getline(v:lnum) =~? '^\s*End\(Sub\)\=Section\>'
let ind = ind - shiftwidth()
endif
return ind
endfunction
endif

View File

@@ -245,19 +245,26 @@ filetypes:
- name: autohotkey
linguist: AutoHotkey
---
name: make
remote: vim/vim:runtime
glob: '**/make.vim'
filetypes:
- name: make
filenames:
- '*[mM]akefile'
extensions:
- mak
- dsp
- mk
---
name: automake
remote: vim/vim:runtime
glob: '**/automake.vim'
filetypes:
- name: automake
filenames:
- Makefile.am
- makefile.am
- '[mM]akefile.am'
- GNUmakefile.am
extensions:
- mak
- dsp
- mk
---
name: asn
remote: vim/vim:runtime
@@ -493,15 +500,8 @@ filetypes:
---
name: dockerfile
remote: ekalinin/Dockerfile.vim
glob: '**/docker-compose.vim'
filetypes:
- name: Dockerfile
linguist: Dockerfile
extra_extensions:
- dock
- Dockerfile
extra_filenames:
- dockerfile
- Dockerfile*
- name: yaml.docker-compose
filenames:
- 'docker-compose*.yaml'
@@ -754,8 +754,13 @@ filetypes:
linguist: HAProxy
extra_filenames:
- 'haproxy*.conf*'
- 'haproxy*.cfg*'
ignored_warnings:
- 'haproxy*.c*'
ignored_extensions:
- cfg
ignored_filenames:
- haproxy.cfg
---
name: haskell
remote: neovimhaskell/haskell-vim
@@ -1471,13 +1476,6 @@ filetypes:
# handled by sbt plugin
- sbt
---
name: sbt
remote: derekwyatt/vim-sbt
filetypes:
- name: sbt.scala
extensions:
- sbt
---
name: scss
remote: cakebaker/scss-syntax.vim
filetypes:
@@ -1497,10 +1495,19 @@ filetypes:
- '.zlogin'
- '.zprofile'
- '.zlogout'
- 'zshrc'
- 'zshenv'
- 'zlogin'
- 'zprofile'
- 'zlogout'
# Udev symlinks config
extra_filenames:
- '*/etc/udev/cdsymlinks.conf'
ignored_interpreters:
- zsh
- name: zsh
interpreters:
- zsh
extensions:
- zsh
filenames:
@@ -1513,6 +1520,7 @@ filetypes:
- '.zcompdump*'
- '.zfbfmarks'
- '.zsh*'
- '*/etc/zprofile'
---
name: zinit
remote: zinit-zsh/zplugin-vim-syntax
@@ -2321,7 +2329,7 @@ glob: "**/dockerfile.vim"
filetypes:
- name: dockerfile
patterns:
- pattern: Containerfile,Dockerfile,*.Dockerfile
- pattern: Containerfile,Dockerfile,*.Dockerfile,*.dock,dockerfile,Dockerfile*
description: Dockerfile; Podman uses the same syntax with name Containerfile
---
name: dcd
@@ -3974,9 +3982,9 @@ glob: "**/pascal.vim"
filetypes:
- name: pascal
patterns:
- pattern: "*.pas"
- pattern: "*.pas,*.pp"
description: Pascal (also *.p)
- pattern: "*.dpr"
- pattern: "*.dpr,*.lpr"
description: Delphi or Lazarus program file
---
name: pdf
@@ -4624,6 +4632,7 @@ filetypes:
name: st
remote: vim/vim:runtime
glob: "**/st.vim"
after: html
filetypes:
- name: st
patterns:
@@ -4969,7 +4978,7 @@ glob: "**/tidy.vim"
filetypes:
- name: tidy
patterns:
- pattern: ".tidyrc,tidyrc"
- pattern: ".tidyrc,tidyrc,tidy.conf"
description: Tidy config
---
name: tf
@@ -5491,3 +5500,11 @@ name: html5
remote: sheerun/html5.vim
dependencies: html
filetypes: []
---
name: xf86conf
remote: vim/vim:runtime
glob: "**/xf86conf.vim"
filetypes:
- name: xf86conf
patterns:
- pattern: "XF86Config-4*,XF86Config*,*/xorg.conf.d/*.conf,xorg.conf,xorg.conf-4"

View File

@@ -22,6 +22,7 @@ def except(hash, *keys)
h
end
def verify(packages, heuristics)
extensions_with_heuristics = Set.new(heuristics.flat_map { |e| e["extensions"] })
no_heuristics = Hash.new { |a, b| a[b] = [] }
@@ -64,7 +65,7 @@ def sort_packages(packages)
for p in packages
for f in p["filetypes"]
for e in f["extensions"]
by_extension[e] << p["name"]
by_extension[e] << p["name"] unless by_extension[e].include?(p["name"])
end
end
end
@@ -84,6 +85,25 @@ def sort_packages(packages)
end
end
end
for e in f["extensions"]
if e.count(".") > 0
ext = e.split(".").last
for name in by_extension[ext]
if p["name"] != name
implicit_dependencies[p["name"]] |= [name]
end
end
end
if e.match?(/[A-Z]/) && by_extension[e.downcase].size > 0
for name in by_extension[e.downcase]
if p["name"] != name
implicit_dependencies[p["name"]] |= [name]
end
end
end
end
end
end
@@ -120,6 +140,7 @@ def load_data()
end
end
end
filetype.delete("patterns")
end
if filetype["linguist"]
if filetype["extensions"]
@@ -338,7 +359,11 @@ def pattern_to_condition(rule)
end
def rules_to_code(rules)
output = ""
output = <<~EOF
if a:0 != 1 && did_filetype()
return
endif
EOF
vars = []
each_hash(rules) do |h|
@@ -595,7 +620,7 @@ def generate_ftdetect(packages, heuristics)
for heuristic in filetype_heuristics.uniq
extensions = heuristic["extensions"].map { |e| "*.#{e}" }
autocommands << "au! BufNewFile,BufRead,BufWritePost #{extensions.join(",")} call polyglot#detect##{camelize(heuristic["extensions"].first)}()"
autocommands << "au BufNewFile,BufRead,BufWritePost #{extensions.join(",")} call polyglot#detect##{camelize(heuristic["extensions"].first)}()"
end
if autocommands.size > 0 && filetype["description"]
@@ -621,7 +646,7 @@ def generate_ftdetect(packages, heuristics)
for heuristic in heuristics
output << <<~EOS
func! polyglot#detect##{camelize(heuristic["extensions"].first)}()
func! polyglot#detect##{camelize(heuristic["extensions"].first)}(...)
#{indent(rules_to_code(heuristic), 2)}
endfunc
EOS
@@ -843,8 +868,4 @@ if __FILE__ == $0
generate_plugins(packages)
generate_tests(packages)
puts(" Bye! Have a wonderful time!")
if !ENV["DEV"]
FileUtils.rm_rf("tmp")
end
end

View File

@@ -1,15 +1,16 @@
#!/usr/bin/env ruby
require 'yaml'
require 'json'
def comma_expanson(s)
s.scan(/{[^{]+}|[^{]+/).map { |a| a[0] == "{" ? a : a.split(",", -1) }.reduce([]) do |a, b|
s.scan(/{[^{]+}|[^{]+/).map { |a| a[0] == "{" ? a : a.split(/(?<!\\),/, -1) }.reduce([]) do |a, b|
a.size > 0 ?
(b.is_a?(String) ?
a[0..-2] + [a[-1] + b] :
a[0..-2] + [a[-1] + b[0]] + b[1..-1]) :
[b].flatten
end
end.map { |e| e.gsub('\\,', ',')}
end
def import_autocommands
@@ -37,6 +38,9 @@ vim -es -u DEFAULTS -c 'exe("func! Capture() \\n redir => capture \\n silent aut
end
end
for k, v in filetypes
filetypes[k].uniq!
end
filetypes
end
@@ -87,8 +91,6 @@ def generate_packages_entries(filetypes, comments)
return entries
end
filetypes = import_autocommands
def fix_quotes(a)
a = a.gsub(/\\/) { '\\\\' }
a.scan(/^.*?"(.+?)"\n/m).each { |p| a[p[0]] = p[0].gsub('"') { '\\"'} }
@@ -114,9 +116,200 @@ def get_comments
result
end
comments = get_comments()
def square_expansion(s)
return [s] unless s.include?('[')
s.scan(/(\[[^\]]+\]|[^\[]+)/).map { |x| x[0] }
.map { |x| x[0] == "[" ? x[1..-2].split("") : [x] }
.reduce(&:product).map(&:flatten).map(&:join)
end
def brace_expansion(s)
if !s.include?('{')
return [s]
end
r=1 # Dummy value to forward-declare the parse function `r`
t=->x{ # Function to parse a bracket block
x=x[0].gsub(/^{(.*)}$/){$1} # Remove outer brackets if both are present
# x[0] is required because of quirks in the `scan` function
x=x.scan(/(({(\g<1>|,)*}|[^,{}]|(?<=,|^)(?=,|$))+)/)
# Regex black magic: collect elements of outer bracket
x.map{|i|i=i[0];i[?{]?r[i]:i}.flatten # For each element with brackets, run parse function
}
r=->x{ # Function to parse bracket expansions a{b,c}{d,e}
i=x.scan(/({(\g<1>)*}|[^{} ]+)/) # Regex black magic: scan for adjacent sets of brackets
i=i.map(&t) # Map all elements against the bracket parser function `t`
i.shift.product(*i).map &:join # Combine the adjacent sets with cartesian product and join them together
}
s.split.map(&r).flatten
end
def generate_tests(autocommands)
existing = JSON.parse(File.read('tmp/vim/vim/src/testdir/test_filetype.vim')
.match(/let s:filename_checks = ({.*?\\ })/m)[1]
.gsub(' \\', ' ').gsub("'", '"')
.gsub('$VIMRUNTIME .', '').gsub(",\n }", "}"))
output = []
generated = {}
for ft in autocommands.keys().sort()
patterns = autocommands[ft]
files1 = []
to_delete = []
patterns.reject! { |p| p.match?(/[\|\\\(]/) }
patterns = patterns.map do |pattern|
pattern = pattern.gsub('[0-9]', '1').gsub('[2-3]', '2').gsub('[1-3]', '1').gsub('?', 'x')
if pattern.match?(/\/\*\.[^\*\/]+$/)
pattern = pattern.gsub(/\/\*\.([^\*\/]+)$/, '/file.\1')
end
if pattern.match?(/[\/\.-]\*$/)
pattern = pattern[0..-2] + "file"
end
pattern = pattern.gsub(/\/\*\//) { '/any/' }
pattern
end
patterns = patterns.flat_map { |p| brace_expansion(p) }
for pattern in patterns
if pattern.match(/^\*[.\,][^\*\/]+$/)
files1 << pattern.gsub('*', 'file')
to_delete << pattern
end
if pattern.match(/^[^\*\/]+\.\*$/)
files1 << pattern.gsub('*', 'file')
to_delete << pattern
end
end
files1.sort!
patterns = patterns - to_delete
files2 = []
for pattern in patterns
if !pattern.match(/\*/)
files2 << pattern
to_delete << pattern
end
end
files2.sort!
patterns = patterns - to_delete
patterns = patterns.flat_map do |pattern|
if pattern.match?(/^\*\//)
[pattern[1..-1], "any" + pattern[1..-1]]
else
[pattern]
end
end
patterns = patterns.flat_map do |pattern|
if pattern.match?(/^\*[-\.]/)
["some" + pattern[1..-1]]
elsif pattern.match?(/^\*/)
[pattern[1..-1], "some-" + pattern[1..-1]]
else
[pattern]
end
end
patterns = patterns.flat_map do |pattern|
if pattern.match?(/[^\/]+\/\*-[^\\]+$/)
[pattern.gsub('/*-', '/file-')]
elsif pattern.match?(/[^\/]+\/\*\.[^\\]+$/)
[pattern.gsub('/*.', '/file.')]
elsif pattern.match?(/[^\/]+\/\*[^\\]+$/)
[pattern.gsub('/*', '/'), pattern.gsub('/*', '/some-')]
else
[pattern]
end
end
patterns = patterns.flat_map do |pattern|
if pattern.include?('-*/')
[pattern.gsub('-*/', '-file/')]
elsif pattern.include?('.*/')
[pattern.gsub('.*/', '.file/')]
elsif pattern.include?('*/')
[pattern.gsub('*/', '/'), pattern.gsub('*/', '-some/')]
else
[pattern]
end
end
patterns = patterns.flat_map do |pattern|
if pattern.match?(/[^\/]+\.\*\.([^\*\/]+)$/)
[pattern.gsub('.*.', '.file.')]
elsif pattern.match?(/[^\/]+-\*\.([^\*\/]+)$/)
[pattern.gsub('-*.', '-file.')]
elsif pattern.match?(/[^\/]+\*\.([^\*\/]+)$/)
[pattern.gsub('*.', '.'), pattern.gsub('*.', '-file.')]
else
[pattern]
end
end
patterns = patterns.flat_map do |pattern|
if pattern.match?(/\*$/)
[pattern[0..-2], pattern[0..-2] + "-file"]
else
[pattern]
end
end
patterns.sort!
files = [*files1, *files2, *patterns].flat_map { |e| square_expansion(e) }
generated[ft] = files
end
for ft, original in existing
for file in generated.fetch(ft, [])
unless original.include?(file) || ['file.DEF', 'file.MOD', 'file.BUILD', 'BUILD'].include?(file) || ft == "help"
original << file
end
end
generated.delete(ft)
output << " \\ '#{ft}': #{JSON.generate(original).gsub('"', "'").gsub("','", "', '")},"
end
for ft, paths in generated
idx = output.find_index { |a| a > " \\ '" + ft }
output.insert(idx, " \\ '#{ft}': #{JSON.generate(paths).gsub('"', "'").gsub("','", "', '")},")
end
output << " \\ }"
msgs = <<'EOF'
\ 'messages': ['/log/auth', '/log/cron', '/log/daemon', '/log/debug', '/log/kern', '/log/lpr', '/log/mail', '/log/messages', '/log/news/news', '/log/syslog', '/log/user',
\ '/log/auth.log', '/log/cron.log', '/log/daemon.log', '/log/debug.log', '/log/kern.log', '/log/lpr.log', '/log/mail.log', '/log/messages.log', '/log/news/news.log', '/log/syslog.log', '/log/user.log',
\ '/log/auth.err', '/log/cron.err', '/log/daemon.err', '/log/debug.err', '/log/kern.err', '/log/lpr.err', '/log/mail.err', '/log/messages.err', '/log/news/news.err', '/log/syslog.err', '/log/user.err',
\ '/log/auth.info', '/log/cron.info', '/log/daemon.info', '/log/debug.info', '/log/kern.info', '/log/lpr.info', '/log/mail.info', '/log/messages.info', '/log/news/news.info', '/log/syslog.info', '/log/user.info',
\ '/log/auth.warn', '/log/cron.warn', '/log/daemon.warn', '/log/debug.warn', '/log/kern.warn', '/log/lpr.warn', '/log/mail.warn', '/log/messages.warn', '/log/news/news.warn', '/log/syslog.warn', '/log/user.warn',
\ '/log/auth.crit', '/log/cron.crit', '/log/daemon.crit', '/log/debug.crit', '/log/kern.crit', '/log/lpr.crit', '/log/mail.crit', '/log/messages.crit', '/log/news/news.crit', '/log/syslog.crit', '/log/user.crit',
\ '/log/auth.notice', '/log/cron.notice', '/log/daemon.notice', '/log/debug.notice', '/log/kern.notice', '/log/lpr.notice', '/log/mail.notice', '/log/messages.notice', '/log/news/news.notice', '/log/syslog.notice', '/log/user.notice'],
EOF
"let s:filename_checks = {\n" + output.join("\n").gsub("'/doc/help.txt'", "$VIMRUNTIME . '/doc/help.txt'").gsub(/ \\ 'messages':.*?\],\n/m) { msgs }
end
#comments = get_comments()
autocommands = import_autocommands()
entries = generate_packages_entries(autocommands, comments)
print(entries.join(""))
# entries = generate_packages_entries(autocommands, comments)
# print(entries.join(""))
result = generate_tests(autocommands)
print(result)

View File

@@ -1,17 +1,17 @@
#!/usr/bin/env ruby
def run_script(src)
system("bash", "-c", src)
if system("bash", "-eo", "pipefail", "-c", src) != true
exit(1)
end
end
def run_vimscript(src)
wrapper = <<~EOF
vim --clean --not-a-term -u <(cat <<- "EOM"
let g:polyglot_test = 1
set nocompatible
let &rtp='$PWD,' . &rtp
filetype plugin indent on
syntax on
let &rtp='#{Dir.pwd},' . &rtp
set t_ti= t_te=
set shortmess+=F
set noswapfile
@@ -23,18 +23,36 @@ def run_vimscript(src)
endif
endfunc
EOM
EOF
wrapper += <<~'EOF'
) -S <(cat <<- "EOM"
try
#{src}
catch
echo v:exception
echo v:throwpoint
endtry
redir @q
silent function /^NewTest_
redir END
let s:tests = split(substitute(@q, '\(function\|def\) \(\k*()\)', '\2', 'g'))
for test in s:tests
echo test
%bwipe!
exe 'call ' . test
set noinsertmode
if len(v:errors) > 0
for err in v:errors
echo err
endfor
cq!
endif
endfor
qa!
EOM
) | perl -pe 's/\e\[[0-9;]*[a-zA-Z]//g'
EOF
wrapper.gsub!('#{src}') { src }
run_script(wrapper)
end
@@ -47,6 +65,11 @@ EOF
run_vimscript('source tests/filetypes.vim')
run_vimscript('source tests/extensions.vim')
if !ENV['DEV']
run_vimscript('source tests/native.vim')
end
run_script(test_helptags)
# run_vimscript("

View File

@@ -1,63 +0,0 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dockerfile') == -1
" Vim syntax file
" Language: Dockerfile
" Maintainer: Eugene Kalinin
" Latest Revision: 11 September 2013
" Source: http://docs.docker.io/en/latest/use/builder/
if exists("b:current_syntax")
finish
endif
" case sensitivity (fix #17)
" syn case ignore
" Keywords
syn keyword dockerfileKeywords FROM AS MAINTAINER RUN CMD COPY
syn keyword dockerfileKeywords EXPOSE ADD ENTRYPOINT
syn keyword dockerfileKeywords VOLUME USER WORKDIR ONBUILD
syn keyword dockerfileKeywords LABEL ARG HEALTHCHECK SHELL STOPSIGNAL
" Bash statements
setlocal iskeyword+=-
syn keyword bashStatement add-apt-repository adduser apk apt-get aptitude apt-key autoconf bundle
syn keyword bashStatement cd chgrp chmod chown clear complete composer cp curl du echo egrep
syn keyword bashStatement expr fgrep find gem gnufind gnugrep gpg grep groupadd head less ln
syn keyword bashStatement ls make mkdir mv node npm pacman pip pip3 php python rails rm rmdir rpm ruby
syn keyword bashStatement sed sleep sort strip tar tail tailf touch useradd virtualenv yum
syn keyword bashStatement usermod bash cat a2ensite a2dissite a2enmod a2dismod apache2ctl
syn keyword bashStatement wget gzip
" Strings
syn region dockerfileString start=/"/ skip=/\\"|\\\\/ end=/"/
syn region dockerfileString1 start=/'/ skip=/\\'|\\\\/ end=/'/
" Emails
syn region dockerfileEmail start=/</ end=/>/ contains=@ oneline
" Urls
syn match dockerfileUrl /\(http\|https\|ssh\|hg\|git\)\:\/\/[a-zA-Z0-9\/\-\._]\+/
" Task tags
syn keyword dockerfileTodo contained TODO FIXME XXX
" Comments
syn region dockerfileComment start="#" end="\n" contains=dockerfileTodo
syn region dockerfileEnvWithComment start="^\s*ENV\>" end="\n" contains=dockerfileEnv
syn match dockerfileEnv contained /\<ENV\>/
" Highlighting
hi link dockerfileKeywords Keyword
hi link dockerfileEnv Keyword
hi link dockerfileString String
hi link dockerfileString1 String
hi link dockerfileComment Comment
hi link dockerfileEmail Identifier
hi link dockerfileUrl Identifier
hi link dockerfileTodo Todo
hi link bashStatement Function
let b:current_syntax = "dockerfile"
endif

148
syntax/make.vim Normal file
View File

@@ -0,0 +1,148 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'make') == -1
" Vim syntax file
" Language: Makefile
" Maintainer: Roland Hieber <rohieb+vim-iR0jGdkV@rohieb.name>, <https://github.com/rohieb>
" Previous Maintainer: Claudio Fleiner <claudio@fleiner.com>
" URL: https://github.com/vim/vim/blob/master/runtime/syntax/make.vim
" Last Change: 2020 May 03
" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
let s:cpo_save = &cpo
set cpo&vim
" some special characters
syn match makeSpecial "^\s*[@+-]\+"
syn match makeNextLine "\\\n\s*"
" catch unmatched define/endef keywords. endef only matches it is by itself on a line, possibly followed by a commend
syn region makeDefine start="^\s*define\s" end="^\s*endef\s*\(#.*\)\?$"
\ contains=makeStatement,makeIdent,makePreCondit,makeDefine
" Microsoft Makefile specials
syn case ignore
syn match makeInclude "^!\s*include\s.*$"
syn match makePreCondit "^!\s*\(cmdswitches\|error\|message\|include\|if\|ifdef\|ifndef\|else\|else\s*if\|else\s*ifdef\|else\s*ifndef\|endif\|undef\)\>"
syn case match
" identifiers
syn region makeIdent start="\$(" skip="\\)\|\\\\" end=")" contains=makeStatement,makeIdent
syn region makeIdent start="\${" skip="\\}\|\\\\" end="}" contains=makeStatement,makeIdent
syn match makeIdent "\$\$\w*"
syn match makeIdent "\$[^({]"
syn match makeIdent "^ *[^:#= \t]*\s*[:+?!*]="me=e-2
syn match makeIdent "^ *[^:#= \t]*\s*::="me=e-3
syn match makeIdent "^ *[^:#= \t]*\s*="me=e-1
syn match makeIdent "%"
" Makefile.in variables
syn match makeConfig "@[A-Za-z0-9_]\+@"
" make targets
syn match makeImplicit "^\.[A-Za-z0-9_./\t -]\+\s*:$"me=e-1
syn match makeImplicit "^\.[A-Za-z0-9_./\t -]\+\s*:[^=]"me=e-2
syn region makeTarget transparent matchgroup=makeTarget
\ start="^[~A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}[^:=]"rs=e-1
\ end=";"re=e-1,me=e-1 end="[^\\]$"
\ keepend contains=makeIdent,makeSpecTarget,makeNextLine,makeComment,makeDString
\ skipnl nextGroup=makeCommands
syn match makeTarget "^[~A-Za-z0-9_./$()%*@-][A-Za-z0-9_./\t $()%*@-]*::\=\s*$"
\ contains=makeIdent,makeSpecTarget,makeComment
\ skipnl nextgroup=makeCommands,makeCommandError
syn region makeSpecTarget transparent matchgroup=makeSpecTarget
\ start="^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\)\>\s*:\{1,2}[^:=]"rs=e-1
\ end="[^\\]$" keepend
\ contains=makeIdent,makeSpecTarget,makeNextLine,makeComment skipnl nextGroup=makeCommands
syn match makeSpecTarget "^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\)\>\s*::\=\s*$"
\ contains=makeIdent,makeComment
\ skipnl nextgroup=makeCommands,makeCommandError
syn match makeCommandError "^\s\+\S.*" contained
syn region makeCommands contained start=";"hs=s+1 start="^\t"
\ end="^[^\t#]"me=e-1,re=e-1 end="^$"
\ contains=makeCmdNextLine,makeSpecial,makeComment,makeIdent,makePreCondit,makeDefine,makeDString,makeSString
\ nextgroup=makeCommandError
syn match makeCmdNextLine "\\\n."he=e-1 contained
" some directives
syn match makePreCondit "^ *\(ifn\=\(eq\|def\)\>\|else\(\s\+ifn\=\(eq\|def\)\)\=\>\|endif\>\)"
syn match makeInclude "^ *[-s]\=include\s.*$"
syn match makeStatement "^ *vpath"
syn match makeExport "^ *\(export\|unexport\)\>"
syn match makeOverride "^ *override\>"
" Statements / Functions (GNU make)
syn match makeStatement contained "(\(abspath\|addprefix\|addsuffix\|and\|basename\|call\|dir\|error\|eval\|file\|filter-out\|filter\|findstring\|firstword\|flavor\|foreach\|guile\|if\|info\|join\|lastword\|notdir\|or\|origin\|patsubst\|realpath\|shell\|sort\|strip\|subst\|suffix\|value\|warning\|wildcard\|word\|wordlist\|words\)\>"ms=s+1
" Comment
if exists("make_microsoft")
syn match makeComment "#.*" contains=@Spell,makeTodo
elseif !exists("make_no_comments")
syn region makeComment start="#" end="^$" end="[^\\]$" keepend contains=@Spell,makeTodo
syn match makeComment "#$" contains=@Spell
endif
syn keyword makeTodo TODO FIXME XXX contained
" match escaped quotes and any other escaped character
" except for $, as a backslash in front of a $ does
" not make it a standard character, but instead it will
" still act as the beginning of a variable
" The escaped char is not highlightet currently
syn match makeEscapedChar "\\[^$]"
syn region makeDString start=+\(\\\)\@<!"+ skip=+\\.+ end=+"+ contained contains=makeIdent
syn region makeSString start=+\(\\\)\@<!'+ skip=+\\.+ end=+'+ contained contains=makeIdent
syn region makeBString start=+\(\\\)\@<!`+ skip=+\\.+ end=+`+ contains=makeIdent,makeSString,makeDString,makeNextLine
" Syncing
syn sync minlines=20 maxlines=200
" Sync on Make command block region: When searching backwards hits a line that
" can't be a command or a comment, use makeCommands if it looks like a target,
" NONE otherwise.
syn sync match makeCommandSync groupthere NONE "^[^\t#]"
syn sync match makeCommandSync groupthere makeCommands "^[A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}[^:=]"
syn sync match makeCommandSync groupthere makeCommands "^[A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}\s*$"
" Define the default highlighting.
" Only when an item doesn't have highlighting yet
hi def link makeNextLine makeSpecial
hi def link makeCmdNextLine makeSpecial
hi link makeOverride makeStatement
hi link makeExport makeStatement
hi def link makeSpecTarget Statement
if !exists("make_no_commands")
hi def link makeCommands Number
endif
hi def link makeImplicit Function
hi def link makeTarget Function
hi def link makeInclude Include
hi def link makePreCondit PreCondit
hi def link makeStatement Statement
hi def link makeIdent Identifier
hi def link makeSpecial Special
hi def link makeComment Comment
hi def link makeDString String
hi def link makeSString String
hi def link makeBString Function
hi def link makeError Error
hi def link makeTodo Todo
hi def link makeDefine Define
hi def link makeCommandError Error
hi def link makeConfig PreCondit
let b:current_syntax = "make"
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: ts=8
endif

View File

@@ -1,9 +1,9 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'sbt') == -1
" Vim syntax file
" Language: sbt
" Maintainer: Derek Wyatt <derek@{myfirstname}{mylastname}.org>
" Last Change: 2013 Oct 20
" Language: sbt
" Maintainer: Steven Dobay <stevendobay at protonmail.com>
" Last Change: 2017.04.30
if exists("b:current_syntax")
finish
@@ -17,7 +17,6 @@ syn match sbtStringEscape "\\[nrfvb\\\"]" contained
syn match sbtIdentitifer "^\S\+\ze\s*\(:=\|++=\|+=\|<<=\|<+=\)"
syn match sbtBeginningSeq "^[Ss]eq\>"
syn match sbtAddPlugin "^addSbtPlugin\>"
syn match sbtSpecial "\(:=\|++=\|+=\|<<=\|<+=\)"
@@ -28,10 +27,10 @@ syn region sbtDocComment start="/\*\*" end="\*/" keepend
hi link sbtString String
hi link sbtIdentitifer Keyword
hi link sbtBeginningSeq Keyword
hi link sbtAddPlugin Keyword
hi link sbtSpecial Special
hi link sbtComment Comment
hi link sbtLineComment Comment
hi link sbtDocComment Comment
endif

209
syntax/xf86conf.vim Normal file
View File

@@ -0,0 +1,209 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'xf86conf') == -1
" Vim syntax file
" This is a GENERATED FILE. Please always refer to source file at the URI below.
" Language: XF86Config (XFree86 configuration file)
" Former Maintainer: David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>
" Last Change: 2010 Nov 01
" URL: http://trific.ath.cx/Ftp/vim/syntax/xf86conf.vim
" Required Vim Version: 6.0
"
" Options: let xf86conf_xfree86_version = 3 or 4
" to force XFree86 3.x or 4.x XF86Config syntax
" Setup
" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
if !exists("b:xf86conf_xfree86_version")
if exists("xf86conf_xfree86_version")
let b:xf86conf_xfree86_version = xf86conf_xfree86_version
else
let b:xf86conf_xfree86_version = 4
endif
endif
syn case ignore
" Comments
syn match xf86confComment "#.*$" contains=xf86confTodo
syn case match
syn keyword xf86confTodo FIXME TODO XXX NOT contained
syn case ignore
syn match xf86confTodo "???" contained
" Sectioning errors
syn keyword xf86confSectionError Section contained
syn keyword xf86confSectionError EndSection
syn keyword xf86confSubSectionError SubSection
syn keyword xf86confSubSectionError EndSubSection
syn keyword xf86confModeSubSectionError Mode
syn keyword xf86confModeSubSectionError EndMode
syn cluster xf86confSectionErrors contains=xf86confSectionError,xf86confSubSectionError,xf86confModeSubSectionError
" Values
if b:xf86conf_xfree86_version >= 4
syn region xf86confString start=+"+ skip=+\\\\\|\\"+ end=+"+ contained contains=xf86confSpecialChar,xf86confConstant,xf86confOptionName oneline keepend nextgroup=xf86confValue skipwhite
else
syn region xf86confString start=+"+ skip=+\\\\\|\\"+ end=+"+ contained contains=xf86confSpecialChar,xf86confOptionName oneline keepend
endif
syn match xf86confSpecialChar "\\\d\d\d\|\\." contained
syn match xf86confDecimalNumber "\(\s\|-\)\zs\d*\.\=\d\+\>"
syn match xf86confFrequency "\(\s\|-\)\zs\d\+\.\=\d*\(Hz\|k\|kHz\|M\|MHz\)"
syn match xf86confOctalNumber "\<0\o\+\>"
syn match xf86confOctalNumberError "\<0\o\+[89]\d*\>"
syn match xf86confHexadecimalNumber "\<0x\x\+\>"
syn match xf86confValue "\s\+.*$" contained contains=xf86confComment,xf86confString,xf86confFrequency,xf86conf\w\+Number,xf86confConstant
syn keyword xf86confOption Option nextgroup=xf86confString skipwhite
syn match xf86confModeLineValue "\"[^\"]\+\"\(\_s\+[0-9.]\+\)\{9}" nextgroup=xf86confSync skipwhite skipnl
" Sections and subsections
if b:xf86conf_xfree86_version >= 4
syn region xf86confSection matchgroup=xf86confSectionDelim start="^\s*Section\s\+\"\(Files\|Server[_ ]*Flags\|Input[_ ]*Device\|Device\|Video[_ ]*Adaptor\|Server[_ ]*Layout\|DRI\|Extensions\|Vendor\|Keyboard\|Pointer\|InputClass\)\"" end="^\s*EndSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confComment,xf86confOption,xf86confKeyword,xf86confSectionError
syn region xf86confSectionModule matchgroup=xf86confSectionDelim start="^\s*Section\s\+\"Module\"" end="^\s*EndSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confSubsectionAny,xf86confComment,xf86confOption,xf86confKeyword
syn region xf86confSectionMonitor matchgroup=xf86confSectionDelim start="^\s*Section\s\+\"Monitor\"" end="^\s*EndSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confSubsectionMode,xf86confModeLine,xf86confComment,xf86confOption,xf86confKeyword
syn region xf86confSectionModes matchgroup=xf86confSectionDelim start="^\s*Section\s\+\"Modes\"" end="^\s*EndSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confSubsectionMode,xf86confModeLine,xf86confComment
syn region xf86confSectionScreen matchgroup=xf86confSectionDelim start="^\s*Section\s\+\"Screen\"" end="^\s*EndSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confSubsectionDisplay,xf86confComment,xf86confOption,xf86confKeyword
syn region xf86confSubSectionAny matchgroup=xf86confSectionDelim start="^\s*SubSection\s\+\"[^\"]\+\"" end="^\s*EndSubSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confComment,xf86confOption,xf86confKeyword,@xf86confSectionErrors
syn region xf86confSubSectionMode matchgroup=xf86confSectionDelim start="^\s*Mode\s\+\"[^\"]\+\"" end="^\s*EndMode\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confComment,xf86confKeyword,@xf86confSectionErrors
syn region xf86confSubSectionDisplay matchgroup=xf86confSectionDelim start="^\s*SubSection\s\+\"Display\"" end="^\s*EndSubSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confComment,xf86confOption,xf86confKeyword,@xf86confSectionErrors
else
syn region xf86confSection matchgroup=xf86confSectionDelim start="^\s*Section\s\+\"\(Files\|Server[_ ]*Flags\|Device\|Keyboard\|Pointer\)\"" end="^\s*EndSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confComment,xf86confOptionName,xf86confOption,xf86confKeyword
syn region xf86confSectionMX matchgroup=xf86confSectionDelim start="^\s*Section\s\+\"\(Module\|Xinput\)\"" end="^\s*EndSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confSubsectionAny,xf86confComment,xf86confOptionName,xf86confOption,xf86confKeyword
syn region xf86confSectionMonitor matchgroup=xf86confSectionDelim start="^\s*Section\s\+\"Monitor\"" end="^\s*EndSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confSubsectionMode,xf86confModeLine,xf86confComment,xf86confOptionName,xf86confOption,xf86confKeyword
syn region xf86confSectionScreen matchgroup=xf86confSectionDelim start="^\s*Section\s\+\"Screen\"" end="^\s*EndSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confSubsectionDisplay,xf86confComment,xf86confOptionName,xf86confOption,xf86confKeyword
syn region xf86confSubSectionAny matchgroup=xf86confSectionDelim start="^\s*SubSection\s\+\"[^\"]\+\"" end="^\s*EndSubSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confComment,xf86confOptionName,xf86confOption,xf86confKeyword,@xf86confSectionErrors
syn region xf86confSubSectionMode matchgroup=xf86confSectionDelim start="^\s*Mode\s\+\"[^\"]\+\"" end="^\s*EndMode\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confComment,xf86confOptionName,xf86confOption,xf86confKeyword,@xf86confSectionErrors
syn region xf86confSubSectionDisplay matchgroup=xf86confSectionDelim start="^\s*SubSection\s\+\"Display\"" end="^\s*EndSubSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confComment,xf86confOptionName,xf86confOption,xf86confKeyword,@xf86confSectionErrors
endif
" Options
if b:xf86conf_xfree86_version >= 4
command -nargs=+ Xf86confdeclopt syn keyword xf86confOptionName <args> contained
else
command -nargs=+ Xf86confdeclopt syn keyword xf86confOptionName <args> contained nextgroup=xf86confValue,xf86confComment skipwhite
endif
Xf86confdeclopt 18bitBus AGPFastWrite AGPMode Accel AllowClosedownGrabs AllowDeactivateGrabs
Xf86confdeclopt AllowMouseOpenFail AllowNonLocalModInDev AllowNonLocalXvidtune AlwaysCore
Xf86confdeclopt AngleOffset AutoRepeat BaudRate BeamTimeout Beep BlankTime BlockWrite BottomX
Xf86confdeclopt BottomY ButtonNumber ButtonThreshold Buttons ByteSwap CacheLines ChordMiddle
Xf86confdeclopt ClearDTR ClearDTS ClickMode CloneDisplay CloneHSync CloneMode CloneVRefresh
Xf86confdeclopt ColorKey Composite CompositeSync CoreKeyboard CorePointer Crt2Memory CrtScreen
Xf86confdeclopt CrtcNumber CyberShadow CyberStretch DDC DDCMode DMAForXv DPMS Dac6Bit DacSpeed
Xf86confdeclopt DataBits Debug DebugLevel DefaultServerLayout DeltaX DeltaY Device DeviceName
Xf86confdeclopt DisableModInDev DisableVidModeExtension Display Display1400 DontVTSwitch
Xf86confdeclopt DontZap DontZoom DoubleScan DozeMode DozeScan DozeTime DragLockButtons
Xf86confdeclopt DualCount DualRefresh EarlyRasPrecharge Emulate3Buttons Emulate3Timeout
Xf86confdeclopt EmulateWheel EmulateWheelButton EmulateWheelInertia EnablePageFlip EnterCount
Xf86confdeclopt EstimateSizesAggressively ExternDisp FPClock16 FPClock24 FPClock32
Xf86confdeclopt FPClock8 FPDither FastDram FifoAggresive FifoConservative FifoModerate
Xf86confdeclopt FireGL3000 FixPanelSize FlatPanel FlipXY FlowControl ForceCRT1 ForceCRT2Type
Xf86confdeclopt ForceLegacyCRT ForcePCIMode FpmVRAM FrameBufferWC FullMMIO GammaBrightness
Xf86confdeclopt HWClocks HWCursor HandleSpecialKeys HistorySize Interlace Interlaced InternDisp
Xf86confdeclopt InvX InvY InvertX InvertY KeepShape LCDClock LateRasPrecharge LcdCenter
Xf86confdeclopt LeftAlt Linear MGASDRAM MMIO MMIOCache MTTR MaxX MaxY MaximumXPosition
Xf86confdeclopt MaximumYPosition MinX MinY MinimumXPosition MinimumYPosition NoAccel
Xf86confdeclopt NoAllowMouseOpenFail NoAllowNonLocalModInDev NoAllowNonLocalXvidtune
Xf86confdeclopt NoBlockWrite NoCompositeSync NoCompression NoCrtScreen NoCyberShadow NoDCC
Xf86confdeclopt NoDDC NoDac6Bit NoDebug NoDisableModInDev NoDisableVidModeExtension NoDontZap
Xf86confdeclopt NoDontZoom NoFireGL3000 NoFixPanelSize NoFpmVRAM NoFrameBufferWC NoHWClocks
Xf86confdeclopt NoHWCursor NoHal NoLcdCenter NoLinear NoMGASDRAM NoMMIO NoMMIOCache NoMTTR
Xf86confdeclopt NoOverClockMem NoOverlay NoPC98 NoPM NoPciBurst NoPciRetry NoProbeClock
Xf86confdeclopt NoSTN NoSWCursor NoShadowFb NoShowCache NoSlowEDODRAM NoStretch NoSuspendHack
Xf86confdeclopt NoTexturedVideo NoTrapSignals NoUseFBDev NoUseModeline NoUseVclk1 NoVTSysReq
Xf86confdeclopt NoXVideo NvAGP OSMImageBuffers OffTime Origin OverClockMem Overlay
Xf86confdeclopt PC98 PCIBurst PM PWMActive PWMSleep PanelDelayCompensation PanelHeight
Xf86confdeclopt PanelOff PanelWidth Parity PciBurst PciRetry Pixmap Port PressDur PressPitch
Xf86confdeclopt PressVol ProbeClocks ProgramFPRegs Protocol RGBBits ReleaseDur ReleasePitch
Xf86confdeclopt ReportingMode Resolution RightAlt RightCtl Rotate STN SWCursor SampleRate
Xf86confdeclopt ScreenNumber ScrollLock SendCoreEvents SendDragEvents Serial ServerNumLock
Xf86confdeclopt SetLcdClk SetMClk SetRefClk ShadowFb ShadowStatus ShowCache SleepMode
Xf86confdeclopt SleepScan SleepTime SlowDram SlowEDODRAM StandbyTime StopBits Stretch
Xf86confdeclopt SuspendHack SuspendTime SwapXY SyncOnGreen TV TVOutput TVOverscan TVStandard
Xf86confdeclopt TVXPosOffset TVYPosOffset TexturedVideo Threshold Tilt TopX TopY TouchTime
Xf86confdeclopt TrapSignals Type USB UseBIOS UseFB UseFBDev UseFlatPanel UseModeline
Xf86confdeclopt UseROMData UseVclk1 VTInit VTSysReq VTime VideoKey Vmin XAxisMapping
Xf86confdeclopt XLeds XVideo XaaNoCPUToScreenColorExpandFill XaaNoColor8x8PatternFillRect
Xf86confdeclopt XaaNoColor8x8PatternFillTrap XaaNoDashedBresenhamLine XaaNoDashedTwoPointLine
Xf86confdeclopt XaaNoImageWriteRect XaaNoMono8x8PatternFillRect XaaNoMono8x8PatternFillTrap
Xf86confdeclopt XaaNoOffscreenPixmaps XaaNoPixmapCache XaaNoScanlineCPUToScreenColorExpandFill
Xf86confdeclopt XaaNoScanlineImageWriteRect XaaNoScreenToScreenColorExpandFill
Xf86confdeclopt XaaNoScreenToScreenCopy XaaNoSolidBresenhamLine XaaNoSolidFillRect
Xf86confdeclopt XaaNoSolidFillTrap XaaNoSolidHorVertLine XaaNoSolidTwoPointLine Xinerama
Xf86confdeclopt XkbCompat XkbDisable XkbGeometry XkbKeycodes XkbKeymap XkbLayout XkbModel
Xf86confdeclopt XkbOptions XkbRules XkbSymbols XkbTypes XkbVariant XvBskew XvHsync XvOnCRT2
Xf86confdeclopt XvRskew XvVsync YAxisMapping ZAxisMapping ZoomOnLCD
delcommand Xf86confdeclopt
" Keywords
syn keyword xf86confKeyword Device Driver FontPath Group Identifier Load ModelName ModulePath Monitor RGBPath VendorName VideoAdaptor Visual nextgroup=xf86confComment,xf86confString skipwhite
syn keyword xf86confKeyword BiosBase Black BoardName BusID ChipID ChipRev Chipset nextgroup=xf86confComment,xf86confValue
syn keyword xf86confKeyword ClockChip Clocks DacSpeed DefaultDepth DefaultFbBpp nextgroup=xf86confComment,xf86confValue
syn keyword xf86confKeyword DefaultColorDepth nextgroup=xf86confComment,xf86confValue
syn keyword xf86confKeyword Depth DisplaySize DotClock FbBpp Flags Gamma HorizSync nextgroup=xf86confComment,xf86confValue
syn keyword xf86confKeyword Hskew HTimings InputDevice IOBase MemBase Mode nextgroup=xf86confComment,xf86confValue
syn keyword xf86confKeyword Modes Ramdac Screen TextClockFreq UseModes VendorName nextgroup=xf86confComment,xf86confValue
syn keyword xf86confKeyword VertRefresh VideoRam ViewPort Virtual VScan VTimings nextgroup=xf86confComment,xf86confValue
syn keyword xf86confKeyword Weight White nextgroup=xf86confComment,xf86confValue
syn keyword xf86confModeLine ModeLine nextgroup=xf86confComment,xf86confModeLineValue skipwhite skipnl
" Constants
if b:xf86conf_xfree86_version >= 4
syn keyword xf86confConstant true false on off yes no omit contained
else
syn keyword xf86confConstant Meta Compose Control
endif
syn keyword xf86confConstant StaticGray GrayScale StaticColor PseudoColor TrueColor DirectColor contained
syn keyword xf86confConstant Absolute RightOf LeftOf Above Below Relative StaticGray GrayScale StaticColor PseudoColor TrueColor DirectColor contained
syn match xf86confSync "\(\s\+[+-][CHV]_*Sync\)\+" contained
" Synchronization
if b:xf86conf_xfree86_version >= 4
syn sync match xf86confSyncSection grouphere xf86confSection "^\s*Section\s\+\"\(Files\|Server[_ ]*Flags\|Input[_ ]*Device\|Device\|Video[_ ]*Adaptor\|Server[_ ]*Layout\|DRI\|Extensions\|Vendor\|Keyboard\|Pointer\|InputClass\)\""
syn sync match xf86confSyncSectionModule grouphere xf86confSectionModule "^\s*Section\s\+\"Module\""
syn sync match xf86confSyncSectionModes groupthere xf86confSectionModes "^\s*Section\s\+\"Modes\""
else
syn sync match xf86confSyncSection grouphere xf86confSection "^\s*Section\s\+\"\(Files\|Server[_ ]*Flags\|Device\|Keyboard\|Pointer\)\""
syn sync match xf86confSyncSectionMX grouphere xf86confSectionMX "^\s*Section\s\+\"\(Module\|Xinput\)\""
endif
syn sync match xf86confSyncSectionMonitor groupthere xf86confSectionMonitor "^\s*Section\s\+\"Monitor\""
syn sync match xf86confSyncSectionScreen groupthere xf86confSectionScreen "^\s*Section\s\+\"Screen\""
syn sync match xf86confSyncEndSection groupthere NONE "^\s*End_*Section\s*$"
" Define the default highlighting
hi def link xf86confComment Comment
hi def link xf86confTodo Todo
hi def link xf86confSectionDelim Statement
hi def link xf86confOptionName Identifier
hi def link xf86confSectionError xf86confError
hi def link xf86confSubSectionError xf86confError
hi def link xf86confModeSubSectionError xf86confError
hi def link xf86confOctalNumberError xf86confError
hi def link xf86confError Error
hi def link xf86confOption xf86confKeyword
hi def link xf86confModeLine xf86confKeyword
hi def link xf86confKeyword Type
hi def link xf86confDecimalNumber xf86confNumber
hi def link xf86confOctalNumber xf86confNumber
hi def link xf86confHexadecimalNumber xf86confNumber
hi def link xf86confFrequency xf86confNumber
hi def link xf86confModeLineValue Constant
hi def link xf86confNumber Constant
hi def link xf86confSync xf86confConstant
hi def link xf86confConstant Special
hi def link xf86confSpecialChar Special
hi def link xf86confString String
hi def link xf86confValue Constant
let b:current_syntax = "xf86conf"
endif

View File

@@ -1,3 +1,5 @@
filetype on
function! TestExtension(filetype, filename, content)
call Log('Detecting ' . a:filetype . ' filetype (' . a:filename . ')...')
@@ -388,3 +390,5 @@ call TestExtension("conf", "auto.master", "")
" https://github.com/sheerun/vim-polyglot/issues/579
call TestExtension("dart", "reminders.dart", "")
filetype off

View File

@@ -1,22 +1,23 @@
function! TestFiletype(filetype)
filetype plugin indent on
func! TestFiletype(filetype)
call Log('Loading ' . a:filetype . ' filetype...')
try
enew
exec 'set ft=' . a:filetype
exec ":bw!"
catch
echo 'Failed to load ' . a:filetype . ' filetype...'
echo v:exception
throw v:exception
cq!
endtry
endfunction
endfunc
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
call TestFiletype('8th')
call TestFiletype('cfg')
call TestFiletype('master')
call TestFiletype('conf')
call TestFiletype('haproxy')
call TestFiletype('a2ps')
call TestFiletype('a65')
call TestFiletype('aap')
@@ -29,6 +30,8 @@ call TestFiletype('asl')
call TestFiletype('ada')
call TestFiletype('ahdl')
call TestFiletype('aidl')
call TestFiletype('master')
call TestFiletype('conf')
call TestFiletype('alsaconf')
call TestFiletype('aml')
call TestFiletype('ampl')
@@ -46,6 +49,7 @@ call TestFiletype('arduino')
call TestFiletype('art')
call TestFiletype('asciidoc')
call TestFiletype('autohotkey')
call TestFiletype('make')
call TestFiletype('elf')
call TestFiletype('automake')
call TestFiletype('asn')
@@ -59,6 +63,7 @@ call TestFiletype('caddyfile')
call TestFiletype('carp')
call TestFiletype('clojure')
call TestFiletype('cmake')
call TestFiletype('markdown')
call TestFiletype('coffee')
call TestFiletype('litcoffee')
call TestFiletype('cryptol')
@@ -73,8 +78,9 @@ call TestFiletype('dcov')
call TestFiletype('dd')
call TestFiletype('ddoc')
call TestFiletype('dsdl')
call TestFiletype('sed')
call TestFiletype('mysql')
call TestFiletype('yaml')
call TestFiletype('Dockerfile')
call TestFiletype('yaml.docker-compose')
call TestFiletype('elixir')
call TestFiletype('eelixir')
@@ -108,6 +114,7 @@ call TestFiletype('grub')
call TestFiletype('haml')
call TestFiletype('html.mustache')
call TestFiletype('html.handlebars')
call TestFiletype('haproxy')
call TestFiletype('haskell')
call TestFiletype('haxe')
call TestFiletype('hcl')
@@ -138,7 +145,6 @@ call TestFiletype('lua')
call TestFiletype('m4')
call TestFiletype('mako')
call TestFiletype('mma')
call TestFiletype('markdown')
call TestFiletype('markdown.mdx')
call TestFiletype('meson')
call TestFiletype('dosini')
@@ -198,7 +204,6 @@ call TestFiletype('ruby')
call TestFiletype('brewfile')
call TestFiletype('rust')
call TestFiletype('scala')
call TestFiletype('sbt.scala')
call TestFiletype('scss')
call TestFiletype('sh')
call TestFiletype('zsh')
@@ -359,6 +364,7 @@ call TestFiletype('hastepreproc')
call TestFiletype('hercules')
call TestFiletype('hex')
call TestFiletype('hollywood')
call TestFiletype('html')
call TestFiletype('tilde')
call TestFiletype('htmlm4')
call TestFiletype('template')
@@ -445,7 +451,6 @@ call TestFiletype('mplayerconf')
call TestFiletype('srec')
call TestFiletype('mrxvtrc')
call TestFiletype('msql')
call TestFiletype('mysql')
call TestFiletype('muttrc')
call TestFiletype('mupad')
call TestFiletype('mush')
@@ -520,10 +525,10 @@ call TestFiletype('samba')
call TestFiletype('sas')
call TestFiletype('sass')
call TestFiletype('sather')
call TestFiletype('sbt')
call TestFiletype('scilab')
call TestFiletype('sd')
call TestFiletype('sdl')
call TestFiletype('sed')
call TestFiletype('sieve')
call TestFiletype('sm')
call TestFiletype('services')
@@ -631,6 +636,9 @@ call TestFiletype('logcheck')
call TestFiletype('svn')
call TestFiletype('text')
call TestFiletype('pullrequest')
call TestFiletype('html')
call TestFiletype('xf86conf')
" DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE
filetype plugin indent off
filetype off

703
tests/native.vim Normal file
View File

@@ -0,0 +1,703 @@
func Test_detection()
filetype on
augroup filetypedetect
au BufNewFile,BufRead * call assert_equal(1, did_filetype())
augroup END
new something.vim
call assert_equal('vim', &filetype)
bwipe!
filetype off
endfunc
func Test_conf_type()
filetype on
call writefile(['# some comment', 'must be conf'], 'Xfile')
augroup filetypedetect
au BufNewFile,BufRead * call assert_equal(0, did_filetype())
augroup END
split Xfile
call assert_equal('conf', &filetype)
bwipe!
call delete('Xfile')
filetype off
endfunc
func Test_other_type()
filetype on
augroup filetypedetect
au BufNewFile,BufRead * call assert_equal(0, did_filetype())
au BufNewFile,BufRead Xfile setf testfile
au BufNewFile,BufRead * call assert_equal(1, did_filetype())
augroup END
call writefile(['# some comment', 'must be conf'], 'Xfile')
split Xfile
call assert_equal('testfile', &filetype)
bwipe!
call delete('Xfile')
filetype off
endfunc
" Filetypes detected just from matching the file name.
let s:filename_checks = {
\ '8th': ['file.8th'],
\ 'a2ps': ['/etc/a2ps.cfg', '/etc/a2ps/file.cfg', 'a2psrc', '.a2psrc', 'any/etc/a2ps.cfg', 'any/etc/a2ps/file.cfg'],
\ 'a65': ['file.a65'],
\ 'aap': ['file.aap'],
\ 'abap': ['file.abap'],
\ 'abc': ['file.abc'],
\ 'abel': ['file.abl'],
\ 'acedb': ['file.wrm'],
\ 'ada': ['file.adb', 'file.ads', 'file.ada', 'file.gpr'],
\ 'ahdl': ['file.tdf'],
\ 'aidl': ['file.aidl'],
\ 'alsaconf': ['.asoundrc', '/usr/share/alsa/alsa.conf', '/etc/asound.conf', 'any/etc/asound.conf', 'any/usr/share/alsa/alsa.conf'],
\ 'aml': ['file.aml'],
\ 'ampl': ['file.run'],
\ 'ant': ['build.xml'],
\ 'apache': ['.htaccess', '/etc/httpd/file.conf', '/etc/apache2/sites-2/file.com', '/etc/apache2/some.config', '/etc/apache2/conf.file/conf', '/etc/apache2/mods-some/file', '/etc/apache2/sites-some/file', '/etc/httpd/conf.d/file.config', '/etc/apache2/conf.file/file', '/etc/apache2/file.conf', '/etc/apache2/file.conf-file', '/etc/apache2/mods-file/file', '/etc/apache2/sites-file/file', '/etc/apache2/sites-file/file.com', '/etc/httpd/conf.d/file.conf', '/etc/httpd/conf.d/file.conf-file', 'access.conf', 'access.conf-file', 'any/etc/apache2/conf.file/file', 'any/etc/apache2/file.conf', 'any/etc/apache2/file.conf-file', 'any/etc/apache2/mods-file/file', 'any/etc/apache2/sites-file/file', 'any/etc/apache2/sites-file/file.com', 'any/etc/httpd/conf.d/file.conf', 'any/etc/httpd/conf.d/file.conf-file', 'any/etc/httpd/file.conf', 'apache.conf', 'apache.conf-file', 'apache2.conf', 'apache2.conf-file', 'httpd.conf', 'httpd.conf-file', 'srm.conf', 'srm.conf-file'],
\ 'apachestyle': ['/etc/proftpd/file.config,/etc/proftpd/conf.file/file', '/etc/proftpd/conf.file/file', '/etc/proftpd/file.conf', '/etc/proftpd/file.conf-file', 'any/etc/proftpd/conf.file/file', 'any/etc/proftpd/file.conf', 'any/etc/proftpd/file.conf-file', 'proftpd.conf', 'proftpd.conf-file'],
\ 'applescript': ['file.scpt'],
\ 'aptconf': ['apt.conf', '/.aptitude/config', 'any/.aptitude/config'],
\ 'arch': ['.arch-inventory', '=tagging-method'],
\ 'arduino': ['file.ino', 'file.pde'],
\ 'art': ['file.art'],
\ 'asciidoc': ['file.asciidoc', 'file.adoc'],
\ 'asn': ['file.asn', 'file.asn1'],
\ 'asterisk': ['asterisk/file.conf', 'asterisk/file.conf-file', 'some-asterisk/file.conf', 'some-asterisk/file.conf-file'],
\ 'atlas': ['file.atl', 'file.as'],
\ 'autohotkey': ['file.ahk'],
\ 'autoit': ['file.au3'],
\ 'automake': ['GNUmakefile.am', 'makefile.am', 'Makefile.am'],
\ 'ave': ['file.ave'],
\ 'awk': ['file.awk', 'file.gawk'],
\ 'b': ['file.mch', 'file.ref', 'file.imp'],
\ 'bzl': ['file.bazel', 'file.bzl', 'WORKSPACE'],
\ 'bc': ['file.bc'],
\ 'bdf': ['file.bdf'],
\ 'bib': ['file.bib'],
\ 'bindzone': ['named.root', '/bind/db.file', '/named/db.file', 'any/bind/db.file', 'any/named/db.file'],
\ 'blank': ['file.bl'],
\ 'bsdl': ['file.bsd', 'file.bsdl', 'bsd', 'some-bsd'],
\ 'bst': ['file.bst'],
\ 'bzr': ['bzr_log.any', 'bzr_log.file'],
\ 'c': ['enlightenment/file.cfg', 'file.qc', 'file.c', 'some-enlightenment/file.cfg'],
\ 'cabal': ['file.cabal'],
\ 'calendar': ['calendar', '/.calendar/file', '/share/calendar/any/calendar.file', '/share/calendar/calendar.file', 'any/.calendar/file', 'any/share/calendar/any/calendar.file', 'any/share/calendar/calendar.file'],
\ 'catalog': ['catalog', 'sgml.catalogfile', 'sgml.catalog', 'sgml.catalog-file'],
\ 'cdl': ['file.cdl'],
\ 'cdrdaoconf': ['/etc/cdrdao.conf', '/etc/defaults/cdrdao', '/etc/default/cdrdao', '.cdrdao', 'any/etc/cdrdao.conf', 'any/etc/default/cdrdao', 'any/etc/defaults/cdrdao'],
\ 'cdrtoc': ['file.toc'],
\ 'cf': ['file.cfm', 'file.cfi', 'file.cfc'],
\ 'cfengine': ['cfengine.conf'],
\ 'cfg': ['file.cfg', 'file.hgrc', 'filehgrc', 'hgrc', 'some-hgrc'],
\ 'ch': ['file.chf'],
\ 'chaiscript': ['file.chai'],
\ 'chaskell': ['file.chs'],
\ 'chill': ['file..ch'],
\ 'chordpro': ['file.chopro', 'file.crd', 'file.cho', 'file.crdpro', 'file.chordpro'],
\ 'cl': ['file.eni'],
\ 'clean': ['file.dcl', 'file.icl'],
\ 'clojure': ['file.clj', 'file.cljs', 'file.cljx', 'file.cljc'],
\ 'cmake': ['CMakeLists.txt', 'file.cmake', 'file.cmake.in'],
\ 'cmusrc': ['any/.cmus/autosave', 'any/.cmus/rc', 'any/.cmus/command-history', 'any/.cmus/file.theme', 'any/cmus/rc', 'any/cmus/file.theme', '/.cmus/autosave', '/.cmus/command-history', '/.cmus/file.theme', '/.cmus/rc', '/cmus/file.theme', '/cmus/rc'],
\ 'cobol': ['file.cbl', 'file.cob', 'file.lib'],
\ 'coco': ['file.atg'],
\ 'conaryrecipe': ['file.recipe'],
\ 'conf': ['auto.master'],
\ 'config': ['configure.in', 'configure.ac', 'Pipfile', '/etc/hostname.file'],
\ 'context': ['tex/context/any/file.tex', 'file.mkii', 'file.mkiv', 'file.mkvi'],
\ 'cpp': ['file.cxx', 'file.c++', 'file.hh', 'file.hxx', 'file.hpp', 'file.ipp', 'file.moc', 'file.tcc', 'file.inl', 'file.tlh'],
\ 'crm': ['file.crm'],
\ 'crontab': ['crontab', 'crontab.file', '/etc/cron.d/file', 'any/etc/cron.d/file'],
\ 'cs': ['file.cs'],
\ 'csc': ['file.csc'],
\ 'csdl': ['file.csdl'],
\ 'csp': ['file.csp', 'file.fdr'],
\ 'css': ['file.css'],
\ 'cterm': ['file.con'],
\ 'cucumber': ['file.feature'],
\ 'cuda': ['file.cu', 'file.cuh'],
\ 'cupl': ['file.pld'],
\ 'cuplsim': ['file.si'],
\ 'cvs': ['cvs123'],
\ 'cvsrc': ['.cvsrc'],
\ 'cynpp': ['file.cyn'],
\ 'dart': ['file.dart', 'file.drt'],
\ 'datascript': ['file.ds'],
\ 'dcd': ['file.dcd'],
\ 'debchangelog': ['changelog.Debian', 'changelog.dch', 'NEWS.Debian', 'NEWS.dch', '/debian/changelog'],
\ 'debcontrol': ['/debian/control', 'any/debian/control'],
\ 'debcopyright': ['/debian/copyright', 'any/debian/copyright'],
\ 'debsources': ['/etc/apt/sources.list', '/etc/apt/sources.list.d/file.list', 'any/etc/apt/sources.list', 'any/etc/apt/sources.list.d/file.list'],
\ 'def': ['file.def'],
\ 'denyhosts': ['denyhosts.conf'],
\ 'desc': ['file.desc'],
\ 'desktop': ['file.desktop', '.directory', 'file.directory'],
\ 'dictconf': ['dict.conf', '.dictrc'],
\ 'dictdconf': ['dictd.conf'],
\ 'diff': ['file.diff', 'file.rej'],
\ 'dircolors': ['.dir_colors', '.dircolors', '/etc/DIR_COLORS', 'any/etc/DIR_COLORS'],
\ 'dnsmasq': ['/etc/dnsmasq.conf', '/etc/dnsmasq.d/file', 'any/etc/dnsmasq.conf', 'any/etc/dnsmasq.d/file'],
\ 'dockerfile': ['Containerfile', 'Dockerfile', 'file.Dockerfile'],
\ 'dosbatch': ['file.bat', 'file.sys'],
\ 'dosini': ['.editorconfig', '/etc/pacman.conf', '/etc/yum.conf', 'file.ini', 'npmrc', '.npmrc', 'php.ini', 'php.ini-5', 'php.ini-file', '/etc/yum.repos.d/file', 'any/etc/pacman.conf', 'any/etc/yum.conf', 'any/etc/yum.repos.d/file'],
\ 'dot': ['file.dot', 'file.gv'],
\ 'dracula': ['file.drac', 'file.drc', 'filelvs', 'filelpe', 'drac.file', 'lpe', 'lvs', 'some-lpe', 'some-lvs'],
\ 'dsl': ['file.dsl'],
\ 'dtd': ['file.dtd'],
\ 'dts': ['file.dts', 'file.dtsi'],
\ 'dylan': ['file.dylan'],
\ 'dylanintr': ['file.intr'],
\ 'dylanlid': ['file.lid'],
\ 'ecd': ['file.ecd'],
\ 'edif': ['file.edf', 'file.edif', 'file.edo'],
\ 'elinks': ['elinks.conf'],
\ 'elm': ['file.elm'],
\ 'elmfilt': ['filter-rules'],
\ 'erlang': ['file.erl', 'file.hrl', 'file.yaws'],
\ 'eruby': ['file.erb', 'file.rhtml'],
\ 'esmtprc': ['anyesmtprc', 'esmtprc', 'some-esmtprc'],
\ 'esqlc': ['file.ec', 'file.EC'],
\ 'esterel': ['file.strl'],
\ 'eterm': ['anyEterm/file.cfg', 'Eterm/file.cfg', 'some-Eterm/file.cfg'],
\ 'exim': ['exim.conf'],
\ 'expect': ['file.exp'],
\ 'exports': ['exports'],
\ 'factor': ['file.factor'],
\ 'falcon': ['file.fal'],
\ 'fan': ['file.fan', 'file.fwt'],
\ 'fetchmail': ['.fetchmailrc'],
\ 'fgl': ['file.4gl', 'file.4gh', 'file.m4gl'],
\ 'focexec': ['file.fex', 'file.focexec'],
\ 'forth': ['file.fs', 'file.ft', 'file.fth'],
\ 'fortran': ['file.f', 'file.for', 'file.fortran', 'file.fpp', 'file.ftn', 'file.f77', 'file.f90', 'file.f95', 'file.f03', 'file.f08'],
\ 'framescript': ['file.fsl'],
\ 'freebasic': ['file.fb', 'file.bi'],
\ 'fstab': ['fstab', 'mtab'],
\ 'fvwm': ['/.fvwm/file', 'any/.fvwm/file'],
\ 'gdb': ['.gdbinit'],
\ 'gdmo': ['file.mo', 'file.gdmo'],
\ 'gedcom': ['file.ged', 'lltxxxxx.txt', '/tmp/lltmp', '/tmp/lltmp-file', 'any/tmp/lltmp', 'any/tmp/lltmp-file'],
\ 'gitcommit': ['COMMIT_EDITMSG', 'MERGE_MSG', 'TAG_EDITMSG'],
\ 'gitconfig': ['file.git/config', '.gitconfig', '.gitmodules', 'file.git/modules//config', '/.config/git/config', '/etc/gitconfig', '/etc/gitconfig.d/file', '/.gitconfig.d/file', 'any/.config/git/config', 'any/.gitconfig.d/file', 'some.git/config', 'some.git/modules/any/config'],
\ 'gitolite': ['gitolite.conf', '/gitolite-admin/conf/file', 'any/gitolite-admin/conf/file'],
\ 'gitrebase': ['git-rebase-todo'],
\ 'gitsendemail': ['.gitsendemail.msg.xxxxxx'],
\ 'gkrellmrc': ['gkrellmrc', 'gkrellmrc_x'],
\ 'gnash': ['gnashrc', '.gnashrc', 'gnashpluginrc', '.gnashpluginrc'],
\ 'gnuplot': ['file.gpi'],
\ 'go': ['file.go'],
\ 'gp': ['file.gp', '.gprc'],
\ 'gpg': ['/.gnupg/options', '/.gnupg/gpg.conf', '/usr/any/gnupg/options.skel', 'any/.gnupg/gpg.conf', 'any/.gnupg/options', 'any/usr/any/gnupg/options.skel'],
\ 'grads': ['file.gs'],
\ 'gretl': ['file.gretl'],
\ 'groovy': ['file.gradle', 'file.groovy'],
\ 'group': ['any/etc/group', 'any/etc/group-', 'any/etc/group.edit', 'any/etc/gshadow', 'any/etc/gshadow-', 'any/etc/gshadow.edit', 'any/var/backups/group.bak', 'any/var/backups/gshadow.bak', '/etc/group', '/etc/group-', '/etc/group.edit', '/etc/gshadow', '/etc/gshadow-', '/etc/gshadow.edit', '/var/backups/group.bak', '/var/backups/gshadow.bak'],
\ 'grub': ['/boot/grub/menu.lst', '/boot/grub/grub.conf', '/etc/grub.conf', 'any/boot/grub/grub.conf', 'any/boot/grub/menu.lst', 'any/etc/grub.conf'],
\ 'gsp': ['file.gsp'],
\ 'gtkrc': ['.gtkrc', 'gtkrc', '.gtkrc-file', 'gtkrc-file'],
\ 'haml': ['file.haml'],
\ 'hamster': ['file.hsc', 'file.hsm'],
\ 'haskell': ['file.hs', 'file.hs-boot'],
\ 'haste': ['file.ht'],
\ 'hastepreproc': ['file.htpp'],
\ 'hb': ['file.hb'],
\ 'hercules': ['file.vc', 'file.ev', 'file.sum', 'file.errsum'],
\ 'hex': ['file.hex', 'file.h32'],
\ 'hgcommit': ['hg-editor-file.txt'],
\ 'hog': ['file.hog', 'snort.conf', 'vision.conf'],
\ 'hollywood': ['file.hws'],
\ 'hostconf': ['/etc/host.conf', 'any/etc/host.conf'],
\ 'hostsaccess': ['/etc/hosts.allow', '/etc/hosts.deny', 'any/etc/hosts.allow', 'any/etc/hosts.deny'],
\ 'logcheck': ['/etc/logcheck/file.d-some/file', '/etc/logcheck/file.d/file', 'any/etc/logcheck/file.d-some/file', 'any/etc/logcheck/file.d/file'],
\ 'modula3': ['file.m3', 'file.mg', 'file.i3', 'file.ig'],
\ 'natural': ['file.NSA', 'file.NSC', 'file.NSG', 'file.NSL', 'file.NSM', 'file.NSN', 'file.NSP', 'file.NSS'],
\ 'neomuttrc': ['Neomuttrc', '.neomuttrc', '.neomuttrc-file', '/.neomutt/neomuttrc', '/.neomutt/neomuttrc-file', 'Neomuttrc', 'Neomuttrc-file', 'any/.neomutt/neomuttrc', 'any/.neomutt/neomuttrc-file', 'neomuttrc', 'neomuttrc-file'],
\ 'opl': ['file.OPL', 'file.OPl', 'file.OpL', 'file.Opl', 'file.oPL', 'file.oPl', 'file.opL', 'file.opl'],
\ 'pcmk': ['file.pcmk'],
\ 'r': ['file.r'],
\ 'rhelp': ['file.rd'],
\ 'rmd': ['file.rmd', 'file.smd'],
\ 'rnoweb': ['file.rnw', 'file.snw'],
\ 'rrst': ['file.rrst', 'file.srst'],
\ 'template': ['file.tmpl'],
\ 'htmlm4': ['file.html.m4'],
\ 'httest': ['file.htt', 'file.htb'],
\ 'ibasic': ['file.iba', 'file.ibi'],
\ 'icemenu': ['/.icewm/menu', 'any/.icewm/menu'],
\ 'icon': ['file.icn'],
\ 'indent': ['.indent.pro', 'indentrc'],
\ 'inform': ['file.inf', 'file.INF'],
\ 'initng': ['/etc/initng/any/file.i', 'file.ii', 'any/etc/initng/any/file.i'],
\ 'inittab': ['inittab'],
\ 'ipfilter': ['ipf.conf', 'ipf6.conf', 'ipf.rules'],
\ 'iss': ['file.iss'],
\ 'ist': ['file.ist', 'file.mst'],
\ 'j': ['file.ijs'],
\ 'jal': ['file.jal', 'file.JAL'],
\ 'jam': ['file.jpl', 'file.jpr', 'JAM-file.file', 'JAM.file', 'Prl-file.file', 'Prl.file'],
\ 'java': ['file.java', 'file.jav'],
\ 'javacc': ['file.jj', 'file.jjt'],
\ 'javascript': ['file.js', 'file.javascript', 'file.es', 'file.mjs', 'file.cjs'],
\ 'javascriptreact': ['file.jsx'],
\ 'jess': ['file.clp'],
\ 'jgraph': ['file.jgr'],
\ 'jovial': ['file.jov', 'file.j73', 'file.jovial'],
\ 'jproperties': ['file.properties', 'file.properties_xx', 'file.properties_xx_xx', 'some.properties_xx_xx_file'],
\ 'json': ['file.json', 'file.jsonp', 'file.webmanifest', 'Pipfile.lock'],
\ 'jsp': ['file.jsp'],
\ 'kconfig': ['Kconfig', 'Kconfig.debug', 'Kconfig.file'],
\ 'kivy': ['file.kv'],
\ 'kix': ['file.kix'],
\ 'kotlin': ['file.kt', 'file.ktm', 'file.kts'],
\ 'kscript': ['file.ks'],
\ 'kwt': ['file.k'],
\ 'lace': ['file.ace', 'file.ACE'],
\ 'latte': ['file.latte', 'file.lte'],
\ 'ld': ['file.ld'],
\ 'ldif': ['file.ldif'],
\ 'less': ['file.less'],
\ 'lex': ['file.lex', 'file.l', 'file.lxx', 'file.l++'],
\ 'lftp': ['lftp.conf', '.lftprc', 'anylftp/rc', 'lftp/rc', 'some-lftp/rc'],
\ 'lhaskell': ['file.lhs'],
\ 'libao': ['/etc/libao.conf', '/.libao', 'any/.libao', 'any/etc/libao.conf'],
\ 'lifelines': ['file.ll'],
\ 'lilo': ['lilo.conf', 'lilo.conf-file'],
\ 'limits': ['/etc/limits', '/etc/anylimits.conf', '/etc/anylimits.d/file.conf', '/etc/limits.conf', '/etc/limits.d/file.conf', '/etc/some-limits.conf', '/etc/some-limits.d/file.conf', 'any/etc/limits', 'any/etc/limits.conf', 'any/etc/limits.d/file.conf', 'any/etc/some-limits.conf', 'any/etc/some-limits.d/file.conf'],
\ 'liquid': ['file.liquid'],
\ 'lisp': ['file.lsp', 'file.lisp', 'file.el', 'file.cl', '.emacs', '.sawfishrc', 'sbclrc', '.sbclrc'],
\ 'lite': ['file.lite', 'file.lt'],
\ 'litestep': ['/LiteStep/any/file.rc', 'any/LiteStep/any/file.rc'],
\ 'loginaccess': ['/etc/login.access', 'any/etc/login.access'],
\ 'logindefs': ['/etc/login.defs', 'any/etc/login.defs'],
\ 'logtalk': ['file.lgt'],
\ 'lotos': ['file.lot', 'file.lotos'],
\ 'lout': ['file.lou', 'file.lout'],
\ 'lprolog': ['file.sig'],
\ 'lsl': ['file.lsl'],
\ 'lss': ['file.lss'],
\ 'lua': ['file.lua', 'file.rockspec', 'file.nse'],
\ 'lynx': ['lynx.cfg'],
\ 'm4': ['file.at'],
\ 'mail': ['snd.123', '.letter', '.letter.123', '.followup', '.article', '.article.123', 'pico.123', 'mutt-xx-xxx', 'muttng-xx-xxx', 'ae123.txt', 'file.eml', 'reportbug-file'],
\ 'mailaliases': ['/etc/mail/aliases', '/etc/aliases', 'any/etc/aliases', 'any/etc/mail/aliases'],
\ 'mailcap': ['.mailcap', 'mailcap'],
\ 'make': ['file.mk', 'file.mak', 'file.dsp', 'makefile', 'Makefile', 'makefile-file', 'Makefile-file', 'some-makefile', 'some-Makefile'],
\ 'mallard': ['file.page'],
\ 'man': ['file.man'],
\ 'manconf': ['/etc/man.conf', 'man.config', 'any/etc/man.conf'],
\ 'map': ['file.map'],
\ 'maple': ['file.mv', 'file.mpl', 'file.mws'],
\ 'markdown': ['file.markdown', 'file.mdown', 'file.mkd', 'file.mkdn', 'file.mdwn', 'file.md'],
\ 'mason': ['file.mason', 'file.mhtml', 'file.comp'],
\ 'master': ['file.mas', 'file.master'],
\ 'mel': ['file.mel'],
\ 'meson': ['meson.build', 'meson_options.txt'],
\ 'messages': ['/log/auth', '/log/cron', '/log/daemon', '/log/debug', '/log/kern', '/log/lpr', '/log/mail', '/log/messages', '/log/news/news', '/log/syslog', '/log/user',
\ '/log/auth.log', '/log/cron.log', '/log/daemon.log', '/log/debug.log', '/log/kern.log', '/log/lpr.log', '/log/mail.log', '/log/messages.log', '/log/news/news.log', '/log/syslog.log', '/log/user.log',
\ '/log/auth.err', '/log/cron.err', '/log/daemon.err', '/log/debug.err', '/log/kern.err', '/log/lpr.err', '/log/mail.err', '/log/messages.err', '/log/news/news.err', '/log/syslog.err', '/log/user.err',
\ '/log/auth.info', '/log/cron.info', '/log/daemon.info', '/log/debug.info', '/log/kern.info', '/log/lpr.info', '/log/mail.info', '/log/messages.info', '/log/news/news.info', '/log/syslog.info', '/log/user.info',
\ '/log/auth.warn', '/log/cron.warn', '/log/daemon.warn', '/log/debug.warn', '/log/kern.warn', '/log/lpr.warn', '/log/mail.warn', '/log/messages.warn', '/log/news/news.warn', '/log/syslog.warn', '/log/user.warn',
\ '/log/auth.crit', '/log/cron.crit', '/log/daemon.crit', '/log/debug.crit', '/log/kern.crit', '/log/lpr.crit', '/log/mail.crit', '/log/messages.crit', '/log/news/news.crit', '/log/syslog.crit', '/log/user.crit',
\ '/log/auth.notice', '/log/cron.notice', '/log/daemon.notice', '/log/debug.notice', '/log/kern.notice', '/log/lpr.notice', '/log/mail.notice', '/log/messages.notice', '/log/news/news.notice', '/log/syslog.notice', '/log/user.notice'],
\ 'mf': ['file.mf'],
\ 'mgl': ['file.mgl'],
\ 'mgp': ['file.mgp'],
\ 'mib': ['file.mib', 'file.my'],
\ 'mix': ['file.mix', 'file.mixal'],
\ 'mma': ['file.nb'],
\ 'mmp': ['file.mmp'],
\ 'modconf': ['/etc/modules.conf', '/etc/modules', '/etc/conf.modules', '/etc/modprobe.file', 'any/etc/conf.modules', 'any/etc/modprobe.file', 'any/etc/modules', 'any/etc/modules.conf'],
\ 'modula2': ['file.m2', 'file.mi'],
\ 'monk': ['file.isc', 'file.monk', 'file.ssc', 'file.tsc'],
\ 'moo': ['file.moo'],
\ 'mp': ['file.mp'],
\ 'mplayerconf': ['mplayer.conf', '/.mplayer/config', 'any/.mplayer/config'],
\ 'mrxvtrc': ['mrxvtrc', '.mrxvtrc'],
\ 'msidl': ['file.odl', 'file.mof'],
\ 'msql': ['file.msql'],
\ 'mupad': ['file.mu'],
\ 'mush': ['file.mush'],
\ 'muttrc': ['Muttngrc', 'Muttrc', '.muttngrc', '.muttngrc-file', '.muttrc', '.muttrc-file', '/.mutt/muttngrc', '/.mutt/muttngrc-file', '/.mutt/muttrc', '/.mutt/muttrc-file', '/.muttng/muttngrc', '/.muttng/muttngrc-file', '/.muttng/muttrc', '/.muttng/muttrc-file', '/etc/Muttrc.d/file', 'Muttngrc-file', 'Muttrc-file', 'any/.mutt/muttngrc', 'any/.mutt/muttngrc-file', 'any/.mutt/muttrc', 'any/.mutt/muttrc-file', 'any/.muttng/muttngrc', 'any/.muttng/muttngrc-file', 'any/.muttng/muttrc', 'any/.muttng/muttrc-file', 'any/etc/Muttrc.d/file', 'muttngrc', 'muttngrc-file', 'muttrc', 'muttrc-file'],
\ 'mysql': ['file.mysql'],
\ 'n1ql': ['file.n1ql', 'file.nql'],
\ 'named': ['namedfile.conf', 'rndcfile.conf', 'named-file.conf', 'named.conf', 'rndc-file.conf', 'rndc-file.key', 'rndc.conf', 'rndc.key'],
\ 'nanorc': ['/etc/nanorc', 'file.nanorc', 'any/etc/nanorc'],
\ 'ncf': ['file.ncf'],
\ 'netrc': ['.netrc'],
\ 'ninja': ['file.ninja'],
\ 'nqc': ['file.nqc'],
\ 'nroff': ['file.tr', 'file.nr', 'file.roff', 'file.tmac', 'file.mom', 'tmac.file'],
\ 'nsis': ['file.nsi', 'file.nsh'],
\ 'obj': ['file.obj'],
\ 'ocaml': ['file.ml', 'file.mli', 'file.mll', 'file.mly', '.ocamlinit'],
\ 'occam': ['file.occ'],
\ 'omnimark': ['file.xom', 'file.xin'],
\ 'openroad': ['file.or'],
\ 'ora': ['file.ora'],
\ 'pamconf': ['/etc/pam.conf', '/etc/pam.d/file', 'any/etc/pam.conf', 'any/etc/pam.d/file'],
\ 'pamenv': ['/etc/security/pam_env.conf', '/home/user/.pam_environment', '.pam_environment', 'pam_env.conf'],
\ 'papp': ['file.papp', 'file.pxml', 'file.pxsl'],
\ 'pascal': ['file.pas', 'file.pp', 'file.dpr', 'file.lpr'],
\ 'passwd': ['any/etc/passwd', 'any/etc/passwd-', 'any/etc/passwd.edit', 'any/etc/shadow', 'any/etc/shadow-', 'any/etc/shadow.edit', 'any/var/backups/passwd.bak', 'any/var/backups/shadow.bak', '/etc/passwd', '/etc/passwd-', '/etc/passwd.edit', '/etc/shadow', '/etc/shadow-', '/etc/shadow.edit', '/var/backups/passwd.bak', '/var/backups/shadow.bak'],
\ 'pccts': ['file.g'],
\ 'pdf': ['file.pdf'],
\ 'perl': ['file.plx', 'file.al', 'file.psgi', 'gitolite.rc', '.gitolite.rc', 'example.gitolite.rc'],
\ 'raku': ['file.p6', 'file.pm6', 'file.pl6', 'file.raku', 'file.rakumod', 'file.pod6'],
\ 'pf': ['pf.conf'],
\ 'pfmain': ['main.cf'],
\ 'php': ['file.php', 'file.php9', 'file.phtml', 'file.ctp'],
\ 'lpc': ['file.lpc', 'file.ulpc'],
\ 'pike': ['file.pike', 'file.pmod'],
\ 'cmod': ['file.cmod'],
\ 'pilrc': ['file.rcp'],
\ 'pine': ['.pinerc', 'pinerc', '.pinercex', 'pinercex'],
\ 'pinfo': ['/etc/pinforc', '/.pinforc', 'any/.pinforc', 'any/etc/pinforc'],
\ 'pli': ['file.pli', 'file.pl1'],
\ 'plm': ['file.plm', 'file.p36', 'file.pac'],
\ 'plp': ['file.plp'],
\ 'plsql': ['file.pls', 'file.plsql'],
\ 'po': ['file.po', 'file.pot'],
\ 'pod': ['file.pod'],
\ 'postscr': ['file.ps', 'file.pfa', 'file.afm', 'file.eps', 'file.epsf', 'file.epsi', 'file.ai'],
\ 'pov': ['file.pov'],
\ 'povini': ['.povrayrc'],
\ 'ppd': ['file.ppd'],
\ 'ppwiz': ['file.it', 'file.ih'],
\ 'privoxy': ['file.action'],
\ 'proc': ['file.pc'],
\ 'procmail': ['.procmail', '.procmailrc'],
\ 'prolog': ['file.pdb'],
\ 'promela': ['file.pml'],
\ 'proto': ['file.proto'],
\ 'protocols': ['/etc/protocols', 'any/etc/protocols'],
\ 'psf': ['file.psf'],
\ 'pyrex': ['file.pyx', 'file.pxd'],
\ 'python': ['file.py', 'file.pyw', '.pythonstartup', '.pythonrc', 'file.ptl', 'file.pyi', 'SConstruct'],
\ 'quake': ['anybaseq2/file.cfg', 'anyid1/file.cfg', 'quake3/file.cfg', 'baseq2/file.cfg', 'id1/file.cfg', 'quake1/file.cfg', 'some-baseq2/file.cfg', 'some-id1/file.cfg', 'some-quake1/file.cfg'],
\ 'radiance': ['file.rad', 'file.mat'],
\ 'ratpoison': ['.ratpoisonrc', 'ratpoisonrc'],
\ 'rc': ['file.rc', 'file.rch'],
\ 'rcs': ['file,v'],
\ 'readline': ['.inputrc', 'inputrc'],
\ 'remind': ['.reminders', 'file.remind', 'file.rem', '.reminders-file'],
\ 'rego': ['file.rego'],
\ 'resolv': ['resolv.conf'],
\ 'reva': ['file.frt'],
\ 'rexx': ['file.rex', 'file.orx', 'file.rxo', 'file.rxj', 'file.jrexx', 'file.rexxj', 'file.rexx', 'file.testGroup', 'file.testUnit'],
\ 'rib': ['file.rib'],
\ 'rnc': ['file.rnc'],
\ 'rng': ['file.rng'],
\ 'robots': ['robots.txt'],
\ 'rpcgen': ['file.x'],
\ 'rpl': ['file.rpl'],
\ 'rst': ['file.rst'],
\ 'rtf': ['file.rtf'],
\ 'ruby': ['.irbrc', 'irbrc', 'file.rb', 'file.rbw', 'file.gemspec', 'file.ru', 'Gemfile', 'file.builder', 'file.rxml', 'file.rjs', 'file.rant', 'file.rake', 'rakefile', 'Rakefile', 'rantfile', 'Rantfile', 'rakefile-file', 'Rakefile-file'],
\ 'rust': ['file.rs'],
\ 'samba': ['smb.conf'],
\ 'sas': ['file.sas'],
\ 'sass': ['file.sass'],
\ 'sather': ['file.sa'],
\ 'sbt': ['file.sbt'],
\ 'scala': ['file.scala'],
\ 'scheme': ['file.scm', 'file.ss', 'file.rkt'],
\ 'scilab': ['file.sci', 'file.sce'],
\ 'screen': ['.screenrc', 'screenrc'],
\ 'scss': ['file.scss'],
\ 'sd': ['file.sd'],
\ 'sdc': ['file.sdc'],
\ 'sdl': ['file.sdl', 'file.pr'],
\ 'sed': ['file.sed'],
\ 'sensors': ['/etc/sensors.conf', '/etc/sensors3.conf', 'any/etc/sensors.conf', 'any/etc/sensors3.conf'],
\ 'services': ['/etc/services', 'any/etc/services'],
\ 'setserial': ['/etc/serial.conf', 'any/etc/serial.conf'],
\ 'sh': ['/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf'],
\ 'sieve': ['file.siv', 'file.sieve'],
\ 'simula': ['file.sim'],
\ 'sinda': ['file.sin', 'file.s85'],
\ 'sisu': ['file.sst', 'file.ssm', 'file.ssi', 'file.-sst', 'file._sst', 'file.sst.meta', 'file.-sst.meta', 'file._sst.meta'],
\ 'skill': ['file.il', 'file.ils', 'file.cdf'],
\ 'slang': ['file.sl'],
\ 'slice': ['file.ice'],
\ 'slpconf': ['/etc/slp.conf', 'any/etc/slp.conf'],
\ 'slpreg': ['/etc/slp.reg', 'any/etc/slp.reg'],
\ 'slpspi': ['/etc/slp.spi', 'any/etc/slp.spi'],
\ 'slrnrc': ['.slrnrc'],
\ 'slrnsc': ['file.score'],
\ 'sm': ['sendmail.cf'],
\ 'smarty': ['file.tpl'],
\ 'smcl': ['file.hlp', 'file.ihlp', 'file.smcl'],
\ 'smith': ['file.smt', 'file.smith'],
\ 'sml': ['file.sml'],
\ 'snobol4': ['file.sno', 'file.spt'],
\ 'spec': ['file.spec'],
\ 'spice': ['file.sp', 'file.spice'],
\ 'spup': ['file.speedup', 'file.spdata', 'file.spd'],
\ 'spyce': ['file.spy', 'file.spi'],
\ 'sql': ['file.tyb', 'file.typ', 'file.tyc', 'file.pkb', 'file.pks'],
\ 'sqlj': ['file.sqlj'],
\ 'sqr': ['file.sqr', 'file.sqi'],
\ 'squid': ['squid.conf'],
\ 'srec': ['file.s19', 'file.s28', 'file.s37', 'file.mot', 'file.srec'],
\ 'sshconfig': ['ssh_config', '/.ssh/config', '/etc/ssh/ssh_config.d/file.conf', 'any/etc/ssh/ssh_config.d/file.conf', 'any/.ssh/config'],
\ 'sshdconfig': ['sshd_config', '/etc/ssh/sshd_config.d/file.conf', 'any/etc/ssh/sshd_config.d/file.conf'],
\ 'st': ['file.st'],
\ 'stata': ['file.ado', 'file.do', 'file.imata', 'file.mata'],
\ 'stp': ['file.stp'],
\ 'sudoers': ['any/etc/sudoers', 'sudoers.tmp', '/etc/sudoers'],
\ 'svg': ['file.svg'],
\ 'svn': ['svn-commitfile.tmp', 'svn-commit-file.tmp', 'svn-commit.tmp'],
\ 'swift': ['file.swift'],
\ 'swiftgyb': ['file.swift.gyb'],
\ 'sil': ['file.sil'],
\ 'sysctl': ['/etc/sysctl.conf', '/etc/sysctl.d/file.conf', 'any/etc/sysctl.conf', 'any/etc/sysctl.d/file.conf'],
\ 'systemd': ['any/systemd/file.automount', 'any/systemd/file.dnssd', 'any/systemd/file.link', 'any/systemd/file.mount', 'any/systemd/file.netdev', 'any/systemd/file.network', 'any/systemd/file.nspawn', 'any/systemd/file.path', 'any/systemd/file.service', 'any/systemd/file.slice', 'any/systemd/file.socket', 'any/systemd/file.swap', 'any/systemd/file.target', 'any/systemd/file.timer', '/etc/systemd/some.conf.d/file.conf', '/etc/systemd/system/some.d/file.conf', '/etc/systemd/system/some.d/.#file', '/etc/systemd/system/.#otherfile', '/home/user/.config/systemd/user/some.d/mine.conf', '/home/user/.config/systemd/user/some.d/.#file', '/home/user/.config/systemd/user/.#otherfile', '/.config/systemd/user/.#', '/.config/systemd/user/.#-file', '/.config/systemd/user/file.d/.#', '/.config/systemd/user/file.d/.#-file', '/.config/systemd/user/file.d/file.conf', '/etc/systemd/file.conf.d/file.conf', '/etc/systemd/system/.#', '/etc/systemd/system/.#-file', '/etc/systemd/system/file.d/.#', '/etc/systemd/system/file.d/.#-file', '/etc/systemd/system/file.d/file.conf', '/systemd/file.automount', '/systemd/file.dnssd', '/systemd/file.link', '/systemd/file.mount', '/systemd/file.netdev', '/systemd/file.network', '/systemd/file.nspawn', '/systemd/file.path', '/systemd/file.service', '/systemd/file.slice', '/systemd/file.socket', '/systemd/file.swap', '/systemd/file.target', '/systemd/file.timer', 'any/.config/systemd/user/.#', 'any/.config/systemd/user/.#-file', 'any/.config/systemd/user/file.d/.#', 'any/.config/systemd/user/file.d/.#-file', 'any/.config/systemd/user/file.d/file.conf', 'any/etc/systemd/file.conf.d/file.conf', 'any/etc/systemd/system/.#', 'any/etc/systemd/system/.#-file', 'any/etc/systemd/system/file.d/.#', 'any/etc/systemd/system/file.d/.#-file', 'any/etc/systemd/system/file.d/file.conf'],
\ 'systemverilog': ['file.sv', 'file.svh'],
\ 'tags': ['tags'],
\ 'tak': ['file.tak'],
\ 'taskdata': ['pending.data', 'completed.data', 'undo.data'],
\ 'taskedit': ['file.task'],
\ 'tcl': ['file.tcl', 'file.tk', 'file.itcl', 'file.itk', 'file.jacl'],
\ 'teraterm': ['file.ttl'],
\ 'terminfo': ['file.ti'],
\ 'tex': ['file.latex', 'file.sty', 'file.dtx', 'file.ltx', 'file.bbl'],
\ 'texinfo': ['file.texinfo', 'file.texi', 'file.txi'],
\ 'texmf': ['texmf.cnf'],
\ 'text': ['file.text', 'README'],
\ 'tf': ['.tfrc', 'tfrc'],
\ 'tidy': ['.tidyrc', 'tidyrc', 'tidy.conf'],
\ 'tilde': ['file.t.html'],
\ 'tli': ['file.tli'],
\ 'tmux': ['tmuxfile.conf', '.tmuxfile.conf', '.tmux-file.conf', '.tmux.conf', 'tmux-file.conf', 'tmux.conf'],
\ 'tpp': ['file.tpp'],
\ 'treetop': ['file.treetop'],
\ 'trustees': ['trustees.conf'],
\ 'tsalt': ['file.slt'],
\ 'tsscl': ['file.tsscl'],
\ 'tssgm': ['file.tssgm'],
\ 'tssop': ['file.tssop'],
\ 'html.twig': ['file.twig'],
\ 'typescript': ['file.ts'],
\ 'typescriptreact': ['file.tsx'],
\ 'uc': ['file.uc'],
\ 'udevconf': ['/etc/udev/udev.conf', 'any/etc/udev/udev.conf'],
\ 'udevperm': ['/etc/udev/permissions.d/file.permissions', 'any/etc/udev/permissions.d/file.permissions'],
\ 'udevrules': ['/etc/udev/rules.d/file.rules', '/usr/lib/udev/rules.d/file.rules', '/lib/udev/rules.d/file.rules'],
\ 'uil': ['file.uit', 'file.uil'],
\ 'updatedb': ['/etc/updatedb.conf', 'any/etc/updatedb.conf'],
\ 'upstart': ['/usr/share/upstart/file.conf', '/usr/share/upstart/file.override', '/etc/init/file.conf', '/etc/init/file.override', '/.init/file.conf', '/.init/file.override', '/.config/upstart/file.conf', '/.config/upstart/file.override', 'any/.config/upstart/file.conf', 'any/.config/upstart/file.override', 'any/.init/file.conf', 'any/.init/file.override', 'any/etc/init/file.conf', 'any/etc/init/file.override', 'any/usr/share/upstart/file.conf', 'any/usr/share/upstart/file.override'],
\ 'upstreamdat': ['upstream.dat', 'UPSTREAM.DAT', 'upstream.file.dat', 'UPSTREAM.FILE.DAT', 'file.upstream.dat', 'FILE.UPSTREAM.DAT'],
\ 'upstreaminstalllog': ['upstreaminstall.log', 'UPSTREAMINSTALL.LOG', 'upstreaminstall.file.log', 'UPSTREAMINSTALL.FILE.LOG', 'file.upstreaminstall.log', 'FILE.UPSTREAMINSTALL.LOG'],
\ 'upstreamlog': ['fdrupstream.log', 'upstream.log', 'UPSTREAM.LOG', 'upstream.file.log', 'UPSTREAM.FILE.LOG', 'file.upstream.log', 'FILE.UPSTREAM.LOG', 'UPSTREAM-file.log', 'UPSTREAM-FILE.LOG'],
\ 'usserverlog': ['usserver.log', 'USSERVER.LOG', 'usserver.file.log', 'USSERVER.FILE.LOG', 'file.usserver.log', 'FILE.USSERVER.LOG'],
\ 'usw2kagtlog': ['usw2kagt.log', 'USW2KAGT.LOG', 'usw2kagt.file.log', 'USW2KAGT.FILE.LOG', 'file.usw2kagt.log', 'FILE.USW2KAGT.LOG'],
\ 'vb': ['file.sba', 'file.vbs', 'file.dsm', 'file.ctl'],
\ 'vera': ['file.vr', 'file.vri', 'file.vrh'],
\ 'verilog': ['file.v'],
\ 'verilogams': ['file.va', 'file.vams'],
\ 'vgrindefs': ['vgrindefs'],
\ 'vhdl': ['file.hdl', 'file.vhd', 'file.vhdl', 'file.vbe', 'file.vst', 'file.vhdl_123', 'file.vho', 'some.vhdl_1', 'some.vhdl_1-file'],
\ 'vim': ['file.vim', 'file.vba', '.exrc', '_exrc', 'some-vimrc', 'some-vimrc-file', 'vimrc', 'vimrc-file'],
\ 'viminfo': ['.viminfo', '_viminfo'],
\ 'vmasm': ['file.mar'],
\ 'voscm': ['file.cm'],
\ 'vrml': ['file.wrl'],
\ 'vroom': ['file.vroom'],
\ 'vue': ['file.vue'],
\ 'wast': ['file.wast', 'file.wat'],
\ 'webmacro': ['file.wm'],
\ 'wget': ['.wgetrc', 'wgetrc'],
\ 'winbatch': ['file.wbt'],
\ 'wml': ['file.wml'],
\ 'wsh': ['file.wsf', 'file.wsc'],
\ 'wsml': ['file.wsml'],
\ 'wvdial': ['wvdial.conf', '.wvdialrc'],
\ 'xdefaults': ['.Xdefaults', '.Xpdefaults', '.Xresources', 'xdm-config', 'file.ad', '/Xresources/file', '/app-defaults/file', 'Xresources', 'Xresources-file', 'any/Xresources/file', 'any/app-defaults/file'],
\ 'xhtml': ['file.xhtml', 'file.xht'],
\ 'xinetd': ['/etc/xinetd.conf', '/etc/xinetd.d/file', 'any/etc/xinetd.conf', 'any/etc/xinetd.d/file'],
\ 'xmath': ['file.msc', 'file.msf'],
\ 'xml': ['/etc/blkid.tab', '/etc/blkid.tab.old', 'file.xmi', 'file.csproj', 'file.csproj.user', 'file.ui', 'file.tpm', '/etc/xdg/menus/file.menu', 'fglrxrc', 'file.xlf', 'file.xliff', 'file.xul', 'file.wsdl', 'file.wpl', 'any/etc/blkid.tab', 'any/etc/blkid.tab.old', 'any/etc/xdg/menus/file.menu'],
\ 'xmodmap': ['anyXmodmap', 'Xmodmap', 'some-Xmodmap', 'some-xmodmap', 'some-xmodmap-file', 'xmodmap', 'xmodmap-file'],
\ 'xf86conf': ['xorg.conf', 'xorg.conf-4'],
\ 'xpm2': ['file.xpm2'],
\ 'xquery': ['file.xq', 'file.xql', 'file.xqm', 'file.xquery', 'file.xqy'],
\ 'xs': ['file.xs'],
\ 'xsd': ['file.xsd'],
\ 'xslt': ['file.xsl', 'file.xslt'],
\ 'yacc': ['file.yy', 'file.yxx', 'file.y++'],
\ 'yaml': ['file.yaml', 'file.yml'],
\ 'raml': ['file.raml'],
\ 'z8a': ['file.z8a'],
\ 'zimbu': ['file.zu'],
\ 'zimbutempl': ['file.zut'],
\ 'zsh': ['.zprofile', '/etc/zprofile', '.zfbfmarks', 'file.zsh', '.zcompdump', '.zlogin', '.zlogout', '.zshenv', '.zshrc', '.zcompdump-file', '.zlog', '.zlog-file', '.zsh', '.zsh-file', 'any/etc/zprofile', 'zlog', 'zlog-file', 'zsh', 'zsh-file'],
\
\ 'help': [$VIMRUNTIME . '/doc/help.txt'],
\ 'xpm': ['file.xpm'],
\ }
let s:filename_case_checks = {
\ 'modula2': ['file.DEF', 'file.MOD'],
\ 'bzl': ['file.BUILD', 'BUILD'],
\ }
func CheckItems(checks)
for [ft, names] in items(a:checks)
for i in range(0, len(names) - 1)
new
try
exe 'edit ' . fnameescape(names[i])
catch
call assert_report('cannot edit "' . names[i] . '": ' . v:exception)
endtry
if &filetype == '' && &readonly
" File exists but not able to edit it (permission denied)
else
call assert_equal(ft, &filetype, 'with file name: ' . names[i])
endif
bwipe!
endfor
endfor
endfunc
func NewTest_filetype_detection()
filetype on
call CheckItems(s:filename_checks)
if has('fname_case')
call CheckItems(s:filename_case_checks)
endif
filetype off
endfunc
" Filetypes detected from the file contents by scripts.vim
let s:script_checks = {
\ 'virata': [['% Virata'],
\ ['', '% Virata'],
\ ['', '', '% Virata'],
\ ['', '', '', '% Virata'],
\ ['', '', '', '', '% Virata']],
\ 'strace': [['execve("/usr/bin/pstree", ["pstree"], 0x7ff0 /* 63 vars */) = 0'],
\ ['15:17:47 execve("/usr/bin/pstree", ["pstree"], ... "_=/usr/bin/strace"]) = 0'],
\ ['__libc_start_main and something']],
\ 'clojure': [['#!/path/clojure']],
\ 'scala': [['#!/path/scala']],
\ 'tcsh': [['#!/path/tcsh']],
\ 'zsh': [['#!/path/zsh']],
\ 'tcl': [['#!/path/tclsh'],
\ ['#!/path/wish'],
\ ['#!/path/expectk'],
\ ['#!/path/itclsh'],
\ ['#!/path/itkwish']],
\ 'expect': [['#!/path/expect']],
\ 'gnuplot': [['#!/path/gnuplot']],
\ 'make': [['#!/path/make']],
\ 'pike': [['#!/path/pike'],
\ ['#!/path/pike0'],
\ ['#!/path/pike9']],
\ 'lua': [['#!/path/lua']],
\ 'raku': [['#!/path/perl6']],
\ 'perl': [['#!/path/perl']],
\ 'php': [['#!/path/php']],
\ 'python': [['#!/path/python'],
\ ['#!/path/python2'],
\ ['#!/path/python3']],
\ 'groovy': [['#!/path/groovy']],
\ 'ruby': [['#!/path/ruby']],
\ 'javascript': [['#!/path/node'],
\ ['#!/path/js'],
\ ['#!/path/nodejs'],
\ ['#!/path/rhino']],
\ 'bc': [['#!/path/bc']],
\ 'sed': [['#!/path/sed']],
\ 'ocaml': [['#!/path/ocaml']],
\ 'awk': [['#!/path/awk'],
\ ['#!/path/gawk']],
\ 'wml': [['#!/path/wml']],
\ 'scheme': [['#!/path/scheme']],
\ 'cfengine': [['#!/path/cfengine']],
\ 'erlang': [['#!/path/escript']],
\ 'haskell': [['#!/path/haskell']],
\ 'cpp': [['// Standard iostream objects -*- C++ -*-'],
\ ['// -*- C++ -*-']],
\ 'yaml': [['%YAML 1.2']],
\ }
" Various forms of "env" optional arguments.
let s:script_env_checks = {
\ 'perl': [['#!/usr/bin/env VAR=val perl']],
\ 'scala': [['#!/usr/bin/env VAR=val VVAR=vval scala']],
\ 'awk': [['#!/usr/bin/env VAR=val -i awk']],
\ 'scheme': [['#!/usr/bin/env VAR=val --ignore-environment scheme']],
\ 'python': [['#!/usr/bin/env VAR=val -S python -w -T']],
\ 'wml': [['#!/usr/bin/env VAR=val --split-string wml']],
\ }
func Run_script_detection(test_dict)
filetype on
for [ft, files] in items(a:test_dict)
for file in files
enew
silent put =file
1delete _
filetype detect
call assert_equal(ft, &filetype, 'for text: ' . string(file))
bwipe!
endfor
endfor
filetype off
endfunc
func Test_script_detection()
call Run_script_detection(s:script_checks)
call Run_script_detection(s:script_env_checks)
endfunc
func Test_setfiletype_completion()
call feedkeys(":setfiletype java\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"setfiletype java javacc javascript javascriptreact', @:)
endfunc
" Test for ':filetype detect' command for a buffer without a file
func Test_emptybuf_ftdetect()
new
call setline(1, '#!/bin/sh')
call assert_equal('', &filetype)
filetype detect
call assert_equal('sh', &filetype)
close!
endfunc
" Test for ':filetype indent on' and ':filetype indent off' commands
func Test_filetype_indent_off()
new Xtest.vim
filetype indent on
call assert_equal(1, g:did_indent_on)
call assert_equal(['filetype detection:ON plugin:OFF indent:ON'],
\ execute('filetype')->split("\n"))
filetype indent off
call assert_equal(0, exists('g:did_indent_on'))
call assert_equal(['filetype detection:ON plugin:OFF indent:OFF'],
\ execute('filetype')->split("\n"))
close
endfunc
func Test_hook_file()
filetype on
call writefile(['[Trigger]', 'this is pacman config'], 'Xfile.hook')
split Xfile.hook
call assert_equal('dosini', &filetype)
bwipe!
call writefile(['not pacman'], 'Xfile.hook')
split Xfile.hook
call assert_notequal('dosini', &filetype)
bwipe!
call delete('Xfile.hook')
filetype off
endfunc