Skip to content

Commit bbee246

Browse files
committed
Add and fix tests from upstream vim
1 parent 3da600a commit bbee246

24 files changed

+1787
-300
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ A collection of language packs for Vim.
77
> One to rule them all, one to find them, one to bring them all and in the darkness bind them.
88
99
- It **won't affect your startup time**, as scripts are loaded only on demand\*.
10-
- It **installs and updates 120+ times faster** than the <!--Package Count-->591<!--/Package Count--> packages it consists of.
10+
- It **installs and updates 120+ times faster** than the <!--Package Count-->593<!--/Package Count--> packages it consists of.
1111
- It is more secure because scripts loaded for all extensions are generated by vim-polyglot (ftdetect).
1212
- Solid syntax and indentation support (other features skipped). Only the best language packs.
1313
- 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
163163
- [rst](https://github.com/marshallward/vim-restructuredtext)
164164
- [ruby](https://github.com/vim-ruby/vim-ruby)
165165
- [rust](https://github.com/rust-lang/rust.vim)
166-
- [sbt](https://github.com/derekwyatt/vim-sbt)
167166
- [scala](https://github.com/derekwyatt/vim-scala)
168167
- [scss](https://github.com/cakebaker/scss-syntax.vim)
169168
- [sh](https://github.com/arzg/vim-sh)

autoload/polyglot/detect.vim

Lines changed: 60 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ set cpo&vim
44

55
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
66

7-
func! polyglot#detect#Inp()
7+
func! polyglot#detect#Inp(...)
8+
if a:0 != 1 && did_filetype()
9+
return
10+
endif
811
let line = getline(nextnonblank(1))
912
if line =~# '^\*'
1013
set ft=abaqus | return
@@ -17,14 +20,20 @@ func! polyglot#detect#Inp()
1720
endfor
1821
endfunc
1922

20-
func! polyglot#detect#Asa()
23+
func! polyglot#detect#Asa(...)
24+
if a:0 != 1 && did_filetype()
25+
return
26+
endif
2127
if exists("g:filetype_asa")
2228
let &ft = g:filetype_asa | return
2329
endif
2430
set ft=aspvbs | return
2531
endfunc
2632

27-
func! polyglot#detect#Asp()
33+
func! polyglot#detect#Asp(...)
34+
if a:0 != 1 && did_filetype()
35+
return
36+
endif
2837
if exists("g:filetype_asp")
2938
let &ft = g:filetype_asp | return
3039
endif
@@ -37,7 +46,10 @@ func! polyglot#detect#Asp()
3746
set ft=aspvbs | return
3847
endfunc
3948

40-
func! polyglot#detect#H()
49+
func! polyglot#detect#H(...)
50+
if a:0 != 1 && did_filetype()
51+
return
52+
endif
4153
for lnum in range(1, min([line("$"), 200]))
4254
let line = getline(lnum)
4355
if line =~# '^\s*\(@\(interface\|class\|protocol\|property\|end\|synchronised\|selector\|implementation\)\(\<\|\>\)\|#import\s\+.\+\.h[">]\)'
@@ -56,7 +68,10 @@ func! polyglot#detect#H()
5668
set ft=cpp | return
5769
endfunc
5870

59-
func! polyglot#detect#M()
71+
func! polyglot#detect#M(...)
72+
if a:0 != 1 && did_filetype()
73+
return
74+
endif
6075
let saw_comment = 0
6176
for lnum in range(1, min([line("$"), 100]))
6277
let line = getline(lnum)
@@ -85,7 +100,10 @@ func! polyglot#detect#M()
85100
set ft=octave | return
86101
endfunc
87102

88-
func! polyglot#detect#Fs()
103+
func! polyglot#detect#Fs(...)
104+
if a:0 != 1 && did_filetype()
105+
return
106+
endif
89107
for lnum in range(1, min([line("$"), 50]))
90108
let line = getline(lnum)
91109
if line =~# '^\(: \|new-device\)'
@@ -104,7 +122,10 @@ func! polyglot#detect#Fs()
104122
set ft=forth | return
105123
endfunc
106124

107-
func! polyglot#detect#Re()
125+
func! polyglot#detect#Re(...)
126+
if a:0 != 1 && did_filetype()
127+
return
128+
endif
108129
for lnum in range(1, min([line("$"), 50]))
109130
let line = getline(lnum)
110131
if line =~# '^\s*#\%(\%(if\|ifdef\|define\|pragma\)\s\+\w\|\s*include\s\+[<"]\|template\s*<\)'
@@ -114,7 +135,10 @@ func! polyglot#detect#Re()
114135
endfor
115136
endfunc
116137

117-
func! polyglot#detect#Idr()
138+
func! polyglot#detect#Idr(...)
139+
if a:0 != 1 && did_filetype()
140+
return
141+
endif
118142
for lnum in range(1, min([line("$"), 5]))
119143
let line = getline(lnum)
120144
if line =~# '^\s*--.*[Ii]dris \=1'
@@ -148,7 +172,10 @@ func! polyglot#detect#Idr()
148172
set ft=idris2 | return
149173
endfunc
150174

151-
func! polyglot#detect#Lidr()
175+
func! polyglot#detect#Lidr(...)
176+
if a:0 != 1 && did_filetype()
177+
return
178+
endif
152179
for lnum in range(1, min([line("$"), 200]))
153180
let line = getline(lnum)
154181
if line =~# '^>\s*--.*[Ii]dris \=1'
@@ -158,7 +185,10 @@ func! polyglot#detect#Lidr()
158185
set ft=lidris2 | return
159186
endfunc
160187

161-
func! polyglot#detect#Bas()
188+
func! polyglot#detect#Bas(...)
189+
if a:0 != 1 && did_filetype()
190+
return
191+
endif
162192
for lnum in range(1, min([line("$"), 5]))
163193
let line = getline(lnum)
164194
if line =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
@@ -168,7 +198,10 @@ func! polyglot#detect#Bas()
168198
set ft=basic | return
169199
endfunc
170200

171-
func! polyglot#detect#Pm()
201+
func! polyglot#detect#Pm(...)
202+
if a:0 != 1 && did_filetype()
203+
return
204+
endif
172205
let line = getline(nextnonblank(1))
173206
if line =~# 'XPM2'
174207
set ft=xpm2 | return
@@ -192,7 +225,10 @@ func! polyglot#detect#Pm()
192225
set ft=perl | return
193226
endfunc
194227

195-
func! polyglot#detect#Pl()
228+
func! polyglot#detect#Pl(...)
229+
if a:0 != 1 && did_filetype()
230+
return
231+
endif
196232
let line = getline(nextnonblank(1))
197233
if line =~# '^[^#]*:-' || line =~# '^\s*\%(%\|/\*\)' || line =~# '\.\s*$'
198234
set ft=prolog | return
@@ -213,7 +249,10 @@ func! polyglot#detect#Pl()
213249
set ft=perl | return
214250
endfunc
215251

216-
func! polyglot#detect#T()
252+
func! polyglot#detect#T(...)
253+
if a:0 != 1 && did_filetype()
254+
return
255+
endif
217256
for lnum in range(1, min([line("$"), 5]))
218257
let line = getline(lnum)
219258
if line =~# '^\.'
@@ -236,7 +275,10 @@ func! polyglot#detect#T()
236275
set ft=perl | return
237276
endfunc
238277

239-
func! polyglot#detect#Tt2()
278+
func! polyglot#detect#Tt2(...)
279+
if a:0 != 1 && did_filetype()
280+
return
281+
endif
240282
for lnum in range(1, min([line("$"), 3]))
241283
let line = getline(lnum)
242284
if line =~? '<\%(!DOCTYPE HTML\|[%?]\|html\)'
@@ -246,7 +288,10 @@ func! polyglot#detect#Tt2()
246288
set ft=tt2 | return
247289
endfunc
248290

249-
func! polyglot#detect#Html()
291+
func! polyglot#detect#Html(...)
292+
if a:0 != 1 && did_filetype()
293+
return
294+
endif
250295
let line = getline(nextnonblank(1))
251296
if line =~# '^\(%\|<[%&].*>\)'
252297
set ft=mason | return

autoload/polyglot/shebang.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,6 @@ let s:interpreters = {
513513
\ 'pdksh': 'sh',
514514
\ 'rc': 'sh',
515515
\ 'sh': 'sh',
516-
\ 'zsh': 'sh',
517516
\ 'boolector': 'smt2',
518517
\ 'cvc4': 'smt2',
519518
\ 'mathsat5': 'smt2',
@@ -526,6 +525,7 @@ let s:interpreters = {
526525
\ 'z3': 'smt2',
527526
\ 'deno': 'typescript',
528527
\ 'ts-node': 'typescript',
528+
\ 'zsh': 'zsh',
529529
\ }
530530
" DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE
531531

autoload/polyglot/sleuth.vim

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
let s:globs = {
22
\ '8th': '*.8th',
3-
\ 'Dockerfile': '*.dockerfile,*.dock,*.Dockerfile,Dockerfile,dockerfile,Dockerfile*',
43
\ 'Jenkinsfile': '*.jenkinsfile,*.Jenkinsfile,Jenkinsfile,Jenkinsfile*',
54
\ 'a2ps': 'a2psrc,.a2psrc',
65
\ 'a65': '*.a65',
@@ -35,7 +34,7 @@ let s:globs = {
3534
\ 'atlas': '*.atl,*.as',
3635
\ 'autohotkey': '*.ahk,*.ahkl',
3736
\ 'autoit': '*.au3',
38-
\ 'automake': '*.mak,*.dsp,*.mk,Makefile.am,makefile.am,GNUmakefile.am',
37+
\ 'automake': '[mM]akefile.am,GNUmakefile.am',
3938
\ 'ave': '*.ave',
4039
\ 'awk': '*.awk,*.gawk',
4140
\ 'b': '*.mch,*.ref,*.imp',
@@ -203,7 +202,7 @@ let s:globs = {
203202
\ 'gtkrc': '.gtkrc,gtkrc,.gtkrc*,gtkrc*',
204203
\ 'haml': '*.haml,*.haml.deface,*.hamlc,*.hamlbars',
205204
\ 'hamster': '*.hsc,*.hsm',
206-
\ 'haproxy': '*.cfg,haproxy.cfg,haproxy*.conf*',
205+
\ 'haproxy': 'haproxy*.conf*,haproxy*.cfg*',
207206
\ 'haskell': '*.hs,*.hs-boot,*.hsc,*.bpk,*.hsig',
208207
\ 'haste': '*.ht',
209208
\ 'hastepreproc': '*.htpp',
@@ -305,6 +304,7 @@ let s:globs = {
305304
\ '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-*',
306305
\ 'mailaliases': '',
307306
\ 'mailcap': '.mailcap,mailcap',
307+
\ 'make': '*.mak,*.dsp,*.mk,*[mM]akefile',
308308
\ 'mako': '*.mako,*.mao',
309309
\ 'mallard': '*.page',
310310
\ 'manconf': 'man.config',
@@ -374,7 +374,7 @@ let s:globs = {
374374
\ 'pamconf': '',
375375
\ 'pamenv': 'pam_env.conf,.pam_environment',
376376
\ 'papp': '*.papp,*.pxml,*.pxsl',
377-
\ 'pascal': '*.pas,*.dpr',
377+
\ 'pascal': '*.pas,*.pp,*.dpr,*.lpr',
378378
\ 'passwd': '',
379379
\ 'pccts': '*.g',
380380
\ 'pcmk': '*.pcmk',
@@ -455,7 +455,7 @@ let s:globs = {
455455
\ 'sas': '*.sas',
456456
\ 'sass': '*.sass',
457457
\ 'sather': '*.sa',
458-
\ 'sbt.scala': '*.sbt',
458+
\ 'sbt': '*.sbt',
459459
\ 'scala': '*.scala,*.kojo,*.sc',
460460
\ 'scheme': '*.scm,*.ss,*.rkt',
461461
\ 'scilab': '*.sci,*.sce',
@@ -469,7 +469,7 @@ let s:globs = {
469469
\ 'services': '',
470470
\ 'setserial': '',
471471
\ 'sexplib': '*.sexp',
472-
\ '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',
472+
\ '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',
473473
\ 'sieve': '*.siv,*.sieve',
474474
\ 'sil': '*.sil',
475475
\ 'simula': '*.sim',
@@ -536,7 +536,7 @@ let s:globs = {
536536
\ 'textile': '*.textile',
537537
\ 'tf': '*.tf,.tfrc,tfrc',
538538
\ 'thrift': '*.thrift',
539-
\ 'tidy': '.tidyrc,tidyrc',
539+
\ 'tidy': '.tidyrc,tidyrc,tidy.conf',
540540
\ 'tilde': '*.t.html',
541541
\ 'tli': '*.tli',
542542
\ 'tmux': '.tmux*.conf',
@@ -594,6 +594,7 @@ let s:globs = {
594594
\ 'wvdial': 'wvdial.conf,.wvdialrc',
595595
\ 'xdc': '*.xdc',
596596
\ 'xdefaults': '*.ad,.Xdefaults,.Xpdefaults,.Xresources,xdm-config,Xresources*',
597+
\ 'xf86conf': 'XF86Config-4*,XF86Config*,xorg.conf,xorg.conf-4',
597598
\ 'xhtml': '*.xhtml,*.xht',
598599
\ 'xinetd': '',
599600
\ 'xmath': '*.msc,*.msf',

0 commit comments

Comments
 (0)