Merge pull request #18067 from zeertzjq/vim-8.2.4714

vim-patch:8.2.{4714,4733}
This commit is contained in:
zeertzjq 2022-04-11 19:30:42 +08:00 committed by GitHub
commit f0d07dcb74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 6 deletions

View File

@ -412,9 +412,9 @@ au BufNewFile,BufRead *Eterm/*.cfg setf eterm
" Elixir or Euphoria
au BufNewFile,BufRead *.ex call dist#ft#ExCheck()
" Elixir, also used for HEEx and Surface
" Elixir
au BufRead,BufNewFile mix.lock,*.exs setf elixir
au BufRead,BufNewFile *.eex,*.heex,*.leex,*.sface setf eelixir
au BufRead,BufNewFile *.eex,*.leex setf eelixir
" Elvish
au BufRead,BufNewFile *.elv setf elvish
@ -793,6 +793,9 @@ au BufRead,BufNewFile *.hcl setf hcl
" Hercules
au BufNewFile,BufRead *.vc,*.ev,*.sum,*.errsum setf hercules
" HEEx
au BufRead,BufNewFile *.heex setf heex
" HEX (Intel)
au BufNewFile,BufRead *.hex,*.h32 setf hex
@ -1898,6 +1901,9 @@ au BufNewFile,BufRead */etc/sudoers,sudoers.tmp setf sudoers
" SVG (Scalable Vector Graphics)
au BufNewFile,BufRead *.svg setf svg
" Surface
au BufRead,BufNewFile *.sface setf surface
" Tads (or Nroff or Perl test file)
au BufNewFile,BufRead *.t
\ if !dist#ft#FTnroff() && !dist#ft#FTperl() | setf tads | endif

View File

@ -173,9 +173,7 @@ local extension = {
lid = "dylanlid",
ecd = "ecd",
eex = "eelixir",
heex = "eelixir",
leex = "eelixir",
sface = "eelixir",
exs = "elixir",
elm = "elm",
elv = "elvish",
@ -269,6 +267,7 @@ local extension = {
ev = "hercules",
vc = "hercules",
hcl = "hcl",
heex = "heex",
hex = "hex",
["h32"] = "hex",
hjson = "hjson",
@ -645,6 +644,7 @@ local extension = {
mata = "stata",
ado = "stata",
stp = "stp",
sface = "surface",
svelte = "svelte",
svg = "svg",
swift = "swift",

View File

@ -166,7 +166,7 @@ let s:filename_checks = {
\ 'edif': ['file.edf', 'file.edif', 'file.edo'],
\ 'elinks': ['elinks.conf'],
\ 'elixir': ['file.ex', 'file.exs', 'mix.lock'],
\ 'eelixir': ['file.eex', 'file.heex', 'file.leex', 'file.sface'],
\ 'eelixir': ['file.eex', 'file.leex'],
\ 'elm': ['file.elm'],
\ 'elmfilt': ['filter-rules'],
\ 'elvish': ['file.elv'],
@ -237,6 +237,7 @@ let s:filename_checks = {
\ 'hb': ['file.hb'],
\ 'hcl': ['file.hcl'],
\ 'hercules': ['file.vc', 'file.ev', 'file.sum', 'file.errsum'],
\ 'heex': ['file.heex'],
\ 'hex': ['file.hex', 'file.h32'],
\ 'hgcommit': ['hg-editor-file.txt'],
\ 'hjson': ['file.hjson'],
@ -515,6 +516,7 @@ let s:filename_checks = {
\ 'stata': ['file.ado', 'file.do', 'file.imata', 'file.mata'],
\ 'stp': ['file.stp'],
\ 'sudoers': ['any/etc/sudoers', 'sudoers.tmp', '/etc/sudoers', 'any/etc/sudoers.d/file'],
\ 'surface': ['file.sface'],
\ 'svg': ['file.svg'],
\ 'svn': ['svn-commitfile.tmp', 'svn-commit-file.tmp', 'svn-commit.tmp'],
\ 'swift': ['file.swift'],
@ -875,23 +877,34 @@ endfunc
func Test_dat_file()
filetype on
" KRL header start with "&WORD", but is not always present.
call writefile(['&ACCESS'], 'datfile.dat')
split datfile.dat
call assert_equal('krl', &filetype)
bwipe!
call delete('datfile.dat')
" KRL defdat with leading spaces, for KRL file extension is not case
" sensitive.
call writefile([' DEFDAT datfile'], 'datfile.Dat')
split datfile.Dat
call assert_equal('krl', &filetype)
bwipe!
call delete('datfile.Dat')
call writefile(['', 'defdat datfile'], 'datfile.DAT')
" KRL defdat with embedded spaces, file starts with empty line(s).
call writefile(['', 'defdat datfile public'], 'datfile.DAT')
split datfile.DAT
call assert_equal('krl', &filetype)
bwipe!
" User may overrule file inspection
let g:filetype_dat = 'dat'
split datfile.DAT
call assert_equal('dat', &filetype)
bwipe!
call delete('datfile.DAT')
unlet g:filetype_dat
filetype off
endfunc
@ -1460,23 +1473,33 @@ endfunc
func Test_src_file()
filetype on
" KRL header start with "&WORD", but is not always present.
call writefile(['&ACCESS'], 'srcfile.src')
split srcfile.src
call assert_equal('krl', &filetype)
bwipe!
call delete('srcfile.src')
" KRL def with leading spaces, for KRL file extension is not case sensitive.
call writefile([' DEF srcfile()'], 'srcfile.Src')
split srcfile.Src
call assert_equal('krl', &filetype)
bwipe!
call delete('srcfile.Src')
" KRL global def with embedded spaces, file starts with empty line(s).
call writefile(['', 'global def srcfile()'], 'srcfile.SRC')
split srcfile.SRC
call assert_equal('krl', &filetype)
bwipe!
" User may overrule file inspection
let g:filetype_src = 'src'
split srcfile.SRC
call assert_equal('src', &filetype)
bwipe!
call delete('srcfile.SRC')
unlet g:filetype_src
filetype off
endfunc