aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/filetype.vim18
-rw-r--r--runtime/scripts.vim8
-rw-r--r--src/nvim/testdir/test_filetype.vim52
3 files changed, 61 insertions, 17 deletions
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 84123aca95..a45c0be810 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -602,12 +602,12 @@ au BufNewFile,BufRead *.mo,*.gdmo setf gdmo
au BufNewFile,BufRead *.ged,lltxxxxx.txt setf gedcom
" Git
-au BufNewFile,BufRead COMMIT_EDITMSG,MERGE_MSG,TAG_EDITMSG setf gitcommit
-au BufNewFile,BufRead *.git/config,.gitconfig,.gitmodules setf gitconfig
-au BufNewFile,BufRead *.git/modules/*/config setf gitconfig
-au BufNewFile,BufRead */.config/git/config setf gitconfig
+au BufNewFile,BufRead COMMIT_EDITMSG,MERGE_MSG,TAG_EDITMSG setf gitcommit
+au BufNewFile,BufRead *.git/config,.gitconfig,/etc/gitconfig setf gitconfig
+au BufNewFile,BufRead */.config/git/config setf gitconfig
+au BufNewFile,BufRead .gitmodules,*.git/modules/*/config setf gitconfig
if !empty($XDG_CONFIG_HOME)
- au BufNewFile,BufRead $XDG_CONFIG_HOME/git/config setf gitconfig
+ au BufNewFile,BufRead $XDG_CONFIG_HOME/git/config setf gitconfig
endif
au BufNewFile,BufRead git-rebase-todo setf gitrebase
au BufRead,BufNewFile .gitsendemail.msg.?????? setf gitsendemail
@@ -1252,9 +1252,9 @@ au BufNewFile,BufRead */etc/protocols setf protocols
" Pyrex
au BufNewFile,BufRead *.pyx,*.pxd setf pyrex
-" Python, Python Shell Startup Files
+" Python, Python Shell Startup and Python Stub Files
" Quixote (Python-based web framework)
-au BufNewFile,BufRead *.py,*.pyw,.pythonstartup,.pythonrc,*.ptl setf python
+au BufNewFile,BufRead *.py,*.pyw,.pythonstartup,.pythonrc,*.ptl,*.pyi setf python
" Radiance
au BufNewFile,BufRead *.rad,*.mat setf radiance
@@ -1403,8 +1403,8 @@ au BufNewFile,BufRead *.sdl,*.pr setf sdl
" sed
au BufNewFile,BufRead *.sed setf sed
-" Sieve (RFC 3028)
-au BufNewFile,BufRead *.siv setf sieve
+" Sieve (RFC 3028, 5228)
+au BufNewFile,BufRead *.siv,*.sieve setf sieve
" Sendmail
au BufNewFile,BufRead sendmail.cf setf sm
diff --git a/runtime/scripts.vim b/runtime/scripts.vim
index 71e3f48bdf..ab66c0c0a1 100644
--- a/runtime/scripts.vim
+++ b/runtime/scripts.vim
@@ -1,7 +1,7 @@
" Vim support file to detect file types in scripts
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last change: 2017 Nov 11
+" Last change: 2018 Feb 03
" This file is called by an autocommand for every file that has just been
" loaded into a buffer. It checks if the type of file can be recognized by
@@ -133,7 +133,7 @@ if s:line1 =~# "^#!"
set ft=ruby
" JavaScript
- elseif s:name =~# 'node\(js\)\=\>' || s:name =~# 'rhino\>'
+ elseif s:name =~# 'node\(js\)\=\>\|js\>' || s:name =~# 'rhino\>'
set ft=javascript
" BC calculator
@@ -176,6 +176,10 @@ if s:line1 =~# "^#!"
elseif s:name =~# 'scala\>'
set ft=scala
+ " Clojure
+ elseif s:name =~# 'clojure'
+ set ft=clojure
+
endif
unlet s:name
diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim
index 43dc383f3d..4403d89121 100644
--- a/src/nvim/testdir/test_filetype.vim
+++ b/src/nvim/testdir/test_filetype.vim
@@ -162,7 +162,7 @@ let s:filename_checks = {
\ 'fetchmail': ['.fetchmailrc'],
\ 'fgl': ['file.4gl', 'file.4gh', 'file.m4gl'],
\ 'focexec': ['file.fex', 'file.focexec'],
- \ 'forth': ['file.fs', 'file.ft'],
+ \ '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'],
@@ -171,7 +171,7 @@ let s:filename_checks = {
\ 'gdmo': ['file.mo', 'file.gdmo'],
\ 'gedcom': ['file.ged', 'lltxxxxx.txt'],
\ 'gitcommit': ['COMMIT_EDITMSG', 'MERGE_MSG', 'TAG_EDITMSG'],
- \ 'gitconfig': ['file.git/config', '.gitconfig', '.gitmodules', 'file.git/modules//config', '/.config/git/config'],
+ \ 'gitconfig': ['file.git/config', '.gitconfig', '.gitmodules', 'file.git/modules//config', '/.config/git/config', '/etc/gitconfig'],
\ 'gitolite': ['gitolite.conf'],
\ 'gitrebase': ['git-rebase-todo'],
\ 'gitsendemail': ['.gitsendemail.msg.xxxxxx'],
@@ -322,7 +322,9 @@ let s:filename_checks = {
\ 'pf': ['pf.conf'],
\ 'pfmain': ['main.cf'],
\ 'php': ['file.php', 'file.php9', 'file.phtml', 'file.ctp'],
- \ 'pike': ['file.pike', 'file.lpc', 'file.ulpc', 'file.pmod'],
+ \ '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'],
@@ -347,7 +349,7 @@ let s:filename_checks = {
\ 'protocols': ['/etc/protocols'],
\ 'psf': ['file.psf'],
\ 'pyrex': ['file.pyx', 'file.pxd'],
- \ 'python': ['file.py', 'file.pyw', '.pythonstartup', '.pythonrc', 'file.ptl'],
+ \ 'python': ['file.py', 'file.pyw', '.pythonstartup', '.pythonrc', 'file.ptl', 'file.pyi'],
\ 'quake': ['anybaseq2/file.cfg', 'anyid1/file.cfg', 'quake3/file.cfg'],
\ 'radiance': ['file.rad', 'file.mat'],
\ 'ratpoison': ['.ratpoisonrc', 'ratpoisonrc'],
@@ -386,7 +388,7 @@ let s:filename_checks = {
\ 'services': ['/etc/services'],
\ 'setserial': ['/etc/serial.conf'],
\ 'sh': ['/etc/udev/cdsymlinks.conf'],
- \ 'sieve': ['file.siv'],
+ \ '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'],
@@ -471,6 +473,7 @@ let s:filename_checks = {
\ 'voscm': ['file.cm'],
\ 'vrml': ['file.wrl'],
\ 'vroom': ['file.vroom'],
+ \ 'wast': ['file.wast', 'file.wat'],
\ 'webmacro': ['file.wm'],
\ 'wget': ['.wgetrc', 'wgetrc'],
\ 'winbatch': ['file.wbt'],
@@ -481,7 +484,7 @@ let s:filename_checks = {
\ 'xhtml': ['file.xhtml', 'file.xht'],
\ 'xinetd': ['/etc/xinetd.conf'],
\ 'xmath': ['file.msc', 'file.msf'],
- \ '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'],
+ \ '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'],
\ 'xmodmap': ['anyXmodmap'],
\ 'xf86conf': ['xorg.conf', 'xorg.conf-4'],
\ 'xpm2': ['file.xpm2'],
@@ -539,6 +542,43 @@ let s:script_checks = {
\ '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']],
+ \ 'perl6': [['#!/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']],
+ \ 'wml': [['#!/path/wml']],
+ \ 'scheme': [['#!/path/scheme']],
+ \ 'cfengine': [['#!/path/cfengine']],
+ \ 'erlang': [['#!/path/escript']],
+ \ 'haskell': [['#!/path/haskell']],
\ }
func Test_script_detection()