Skip to content

Commit fb8f822

Browse files
committed
2 parents 17a5dde + e101cdb commit fb8f822

File tree

3 files changed

+61
-17
lines changed

3 files changed

+61
-17
lines changed

runtime/filetype.vim

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -602,12 +602,12 @@ au BufNewFile,BufRead *.mo,*.gdmo setf gdmo
602602
au BufNewFile,BufRead *.ged,lltxxxxx.txt setf gedcom
603603

604604
" Git
605-
au BufNewFile,BufRead COMMIT_EDITMSG,MERGE_MSG,TAG_EDITMSG setf gitcommit
606-
au BufNewFile,BufRead *.git/config,.gitconfig,.gitmodules setf gitconfig
607-
au BufNewFile,BufRead *.git/modules/*/config setf gitconfig
608-
au BufNewFile,BufRead */.config/git/config setf gitconfig
605+
au BufNewFile,BufRead COMMIT_EDITMSG,MERGE_MSG,TAG_EDITMSG setf gitcommit
606+
au BufNewFile,BufRead *.git/config,.gitconfig,/etc/gitconfig setf gitconfig
607+
au BufNewFile,BufRead */.config/git/config setf gitconfig
608+
au BufNewFile,BufRead .gitmodules,*.git/modules/*/config setf gitconfig
609609
if !empty($XDG_CONFIG_HOME)
610-
au BufNewFile,BufRead $XDG_CONFIG_HOME/git/config setf gitconfig
610+
au BufNewFile,BufRead $XDG_CONFIG_HOME/git/config setf gitconfig
611611
endif
612612
au BufNewFile,BufRead git-rebase-todo setf gitrebase
613613
au BufRead,BufNewFile .gitsendemail.msg.?????? setf gitsendemail
@@ -1252,9 +1252,9 @@ au BufNewFile,BufRead */etc/protocols setf protocols
12521252
" Pyrex
12531253
au BufNewFile,BufRead *.pyx,*.pxd setf pyrex
12541254

1255-
" Python, Python Shell Startup Files
1255+
" Python, Python Shell Startup and Python Stub Files
12561256
" Quixote (Python-based web framework)
1257-
au BufNewFile,BufRead *.py,*.pyw,.pythonstartup,.pythonrc,*.ptl setf python
1257+
au BufNewFile,BufRead *.py,*.pyw,.pythonstartup,.pythonrc,*.ptl,*.pyi setf python
12581258

12591259
" Radiance
12601260
au BufNewFile,BufRead *.rad,*.mat setf radiance
@@ -1403,8 +1403,8 @@ au BufNewFile,BufRead *.sdl,*.pr setf sdl
14031403
" sed
14041404
au BufNewFile,BufRead *.sed setf sed
14051405

1406-
" Sieve (RFC 3028)
1407-
au BufNewFile,BufRead *.siv setf sieve
1406+
" Sieve (RFC 3028, 5228)
1407+
au BufNewFile,BufRead *.siv,*.sieve setf sieve
14081408

14091409
" Sendmail
14101410
au BufNewFile,BufRead sendmail.cf setf sm

runtime/scripts.vim

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" Vim support file to detect file types in scripts
22
"
33
" Maintainer: Bram Moolenaar <Bram@vim.org>
4-
" Last change: 2017 Nov 11
4+
" Last change: 2018 Feb 03
55

66
" This file is called by an autocommand for every file that has just been
77
" loaded into a buffer. It checks if the type of file can be recognized by
@@ -133,7 +133,7 @@ if s:line1 =~# "^#!"
133133
set ft=ruby
134134

135135
" JavaScript
136-
elseif s:name =~# 'node\(js\)\=\>' || s:name =~# 'rhino\>'
136+
elseif s:name =~# 'node\(js\)\=\>\|js\>' || s:name =~# 'rhino\>'
137137
set ft=javascript
138138

139139
" BC calculator
@@ -176,6 +176,10 @@ if s:line1 =~# "^#!"
176176
elseif s:name =~# 'scala\>'
177177
set ft=scala
178178

179+
" Clojure
180+
elseif s:name =~# 'clojure'
181+
set ft=clojure
182+
179183
endif
180184
unlet s:name
181185

src/nvim/testdir/test_filetype.vim

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ let s:filename_checks = {
162162
\ 'fetchmail': ['.fetchmailrc'],
163163
\ 'fgl': ['file.4gl', 'file.4gh', 'file.m4gl'],
164164
\ 'focexec': ['file.fex', 'file.focexec'],
165-
\ 'forth': ['file.fs', 'file.ft'],
165+
\ 'forth': ['file.fs', 'file.ft', 'file.fth'],
166166
\ 'fortran': ['file.f', 'file.for', 'file.fortran', 'file.fpp', 'file.ftn', 'file.f77', 'file.f90', 'file.f95', 'file.f03', 'file.f08'],
167167
\ 'framescript': ['file.fsl'],
168168
\ 'freebasic': ['file.fb', 'file.bi'],
@@ -171,7 +171,7 @@ let s:filename_checks = {
171171
\ 'gdmo': ['file.mo', 'file.gdmo'],
172172
\ 'gedcom': ['file.ged', 'lltxxxxx.txt'],
173173
\ 'gitcommit': ['COMMIT_EDITMSG', 'MERGE_MSG', 'TAG_EDITMSG'],
174-
\ 'gitconfig': ['file.git/config', '.gitconfig', '.gitmodules', 'file.git/modules//config', '/.config/git/config'],
174+
\ 'gitconfig': ['file.git/config', '.gitconfig', '.gitmodules', 'file.git/modules//config', '/.config/git/config', '/etc/gitconfig'],
175175
\ 'gitolite': ['gitolite.conf'],
176176
\ 'gitrebase': ['git-rebase-todo'],
177177
\ 'gitsendemail': ['.gitsendemail.msg.xxxxxx'],
@@ -322,7 +322,9 @@ let s:filename_checks = {
322322
\ 'pf': ['pf.conf'],
323323
\ 'pfmain': ['main.cf'],
324324
\ 'php': ['file.php', 'file.php9', 'file.phtml', 'file.ctp'],
325-
\ 'pike': ['file.pike', 'file.lpc', 'file.ulpc', 'file.pmod'],
325+
\ 'lpc': ['file.lpc', 'file.ulpc'],
326+
\ 'pike': ['file.pike', 'file.pmod'],
327+
\ 'cmod': ['file.cmod'],
326328
\ 'pilrc': ['file.rcp'],
327329
\ 'pine': ['.pinerc', 'pinerc', '.pinercex', 'pinercex'],
328330
\ 'pinfo': ['/etc/pinforc', '/.pinforc'],
@@ -347,7 +349,7 @@ let s:filename_checks = {
347349
\ 'protocols': ['/etc/protocols'],
348350
\ 'psf': ['file.psf'],
349351
\ 'pyrex': ['file.pyx', 'file.pxd'],
350-
\ 'python': ['file.py', 'file.pyw', '.pythonstartup', '.pythonrc', 'file.ptl'],
352+
\ 'python': ['file.py', 'file.pyw', '.pythonstartup', '.pythonrc', 'file.ptl', 'file.pyi'],
351353
\ 'quake': ['anybaseq2/file.cfg', 'anyid1/file.cfg', 'quake3/file.cfg'],
352354
\ 'radiance': ['file.rad', 'file.mat'],
353355
\ 'ratpoison': ['.ratpoisonrc', 'ratpoisonrc'],
@@ -386,7 +388,7 @@ let s:filename_checks = {
386388
\ 'services': ['/etc/services'],
387389
\ 'setserial': ['/etc/serial.conf'],
388390
\ 'sh': ['/etc/udev/cdsymlinks.conf'],
389-
\ 'sieve': ['file.siv'],
391+
\ 'sieve': ['file.siv', 'file.sieve'],
390392
\ 'simula': ['file.sim'],
391393
\ 'sinda': ['file.sin', 'file.s85'],
392394
\ 'sisu': ['file.sst', 'file.ssm', 'file.ssi', 'file.-sst', 'file._sst', 'file.sst.meta', 'file.-sst.meta', 'file._sst.meta'],
@@ -471,6 +473,7 @@ let s:filename_checks = {
471473
\ 'voscm': ['file.cm'],
472474
\ 'vrml': ['file.wrl'],
473475
\ 'vroom': ['file.vroom'],
476+
\ 'wast': ['file.wast', 'file.wat'],
474477
\ 'webmacro': ['file.wm'],
475478
\ 'wget': ['.wgetrc', 'wgetrc'],
476479
\ 'winbatch': ['file.wbt'],
@@ -481,7 +484,7 @@ let s:filename_checks = {
481484
\ 'xhtml': ['file.xhtml', 'file.xht'],
482485
\ 'xinetd': ['/etc/xinetd.conf'],
483486
\ 'xmath': ['file.msc', 'file.msf'],
484-
\ 'xml': ['/etc/blkid.tab', '/etc/blkid.tab.old', 'file.xmi', 'file.csproj', 'file.csproj.user', 'file.ts', 'file.ui', 'file.tpm', '/etc/xdg/menus/file.menu', 'fglrxrc', 'file.xlf', 'file.xliff', 'file.xul'],
487+
\ 'xml': ['/etc/blkid.tab', '/etc/blkid.tab.old', 'file.xmi', 'file.csproj', 'file.csproj.user', 'file.ts', 'file.ui', 'file.tpm', '/etc/xdg/menus/file.menu', 'fglrxrc', 'file.xlf', 'file.xliff', 'file.xul', 'file.wsdl'],
485488
\ 'xmodmap': ['anyXmodmap'],
486489
\ 'xf86conf': ['xorg.conf', 'xorg.conf-4'],
487490
\ 'xpm2': ['file.xpm2'],
@@ -539,6 +542,43 @@ let s:script_checks = {
539542
\ 'strace': [['execve("/usr/bin/pstree", ["pstree"], 0x7ff0 /* 63 vars */) = 0'],
540543
\ ['15:17:47 execve("/usr/bin/pstree", ["pstree"], ... "_=/usr/bin/strace"]) = 0'],
541544
\ ['__libc_start_main and something']],
545+
\ 'clojure': [['#!/path/clojure']],
546+
\ 'scala': [['#!/path/scala']],
547+
\ 'tcsh': [['#!/path/tcsh']],
548+
\ 'zsh': [['#!/path/zsh']],
549+
\ 'tcl': [['#!/path/tclsh'],
550+
\ ['#!/path/wish'],
551+
\ ['#!/path/expectk'],
552+
\ ['#!/path/itclsh'],
553+
\ ['#!/path/itkwish']],
554+
\ 'expect': [['#!/path/expect']],
555+
\ 'gnuplot': [['#!/path/gnuplot']],
556+
\ 'make': [['#!/path/make']],
557+
\ 'pike': [['#!/path/pike'],
558+
\ ['#!/path/pike0'],
559+
\ ['#!/path/pike9']],
560+
\ 'lua': [['#!/path/lua']],
561+
\ 'perl6': [['#!/path/perl6']],
562+
\ 'perl': [['#!/path/perl']],
563+
\ 'php': [['#!/path/php']],
564+
\ 'python': [['#!/path/python'],
565+
\ ['#!/path/python2'],
566+
\ ['#!/path/python3']],
567+
\ 'groovy': [['#!/path/groovy']],
568+
\ 'ruby': [['#!/path/ruby']],
569+
\ 'javascript': [['#!/path/node'],
570+
\ ['#!/path/js'],
571+
\ ['#!/path/nodejs'],
572+
\ ['#!/path/rhino']],
573+
\ 'bc': [['#!/path/bc']],
574+
\ 'sed': [['#!/path/sed']],
575+
\ 'ocaml': [['#!/path/ocaml']],
576+
\ 'awk': [['#!/path/awk']],
577+
\ 'wml': [['#!/path/wml']],
578+
\ 'scheme': [['#!/path/scheme']],
579+
\ 'cfengine': [['#!/path/cfengine']],
580+
\ 'erlang': [['#!/path/escript']],
581+
\ 'haskell': [['#!/path/haskell']],
542582
\ }
543583

544584
func Test_script_detection()

0 commit comments

Comments
 (0)