changeset 28445:7f0ec490d608 v8.2.4747

patch 8.2.4747: no filetype override for .sys files Commit: https://github.com/vim/vim/commit/f420ff2440a009acd9573fdb6ad6d53509d78009 Author: KnoP-01 <knosowski@graeffrobotics.de> Date: Wed Apr 13 20:46:21 2022 +0100 patch 8.2.4747: no filetype override for .sys files Problem: No filetype override for .sys files. Solution: Add g:filetype_sys. (Patrick Meiser-Knosowski, closes https://github.com/vim/vim/issues/10181)
author Bram Moolenaar <Bram@vim.org>
date Wed, 13 Apr 2022 22:00:04 +0200
parents 5371ee467711
children 224455817fac
files runtime/autoload/dist/ft.vim runtime/doc/filetype.txt src/testdir/test_filetype.vim src/version.c
diffstat 4 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -819,7 +819,9 @@ export def FTperl(): number
 enddef
 
 export def FTsys()
-  if IsRapid()
+  if exists("g:filetype_sys")
+    exe "setf " .. g:filetype_sys
+  elseif IsRapid()
     setf rapid
   else
     setf bat
--- a/runtime/doc/filetype.txt
+++ b/runtime/doc/filetype.txt
@@ -155,6 +155,7 @@ variables can be used to overrule the fi
 	*.pp		g:filetype_pp	|ft-pascal-syntax|
 	*.prg		g:filetype_prg
 	*.src		g:filetype_src
+	*.sys		g:filetype_sys
 	*.sh		g:bash_is_sh	|ft-sh-syntax|
 	*.tex		g:tex_flavor	|ft-tex-plugin|
 	*.w		g:filetype_w	|ft-cweb-syntax|
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -1501,7 +1501,7 @@ endfunc
 func Test_sc_file()
   filetype on
 
-  " SC file mehtods are defined 'Class : Method'
+  " SC file methods are defined 'Class : Method'
   call writefile(['SCNvimDocRenderer : SCDocHTMLRenderer {'], 'srcfile.sc')
   split srcfile.sc
   call assert_equal('supercollider', &filetype)
@@ -1588,6 +1588,13 @@ func Test_sys_file()
   call assert_equal('bat', &filetype)
   bwipe!
 
+  " Users preference set by g:filetype_sys
+  let g:filetype_sys = 'sys'
+  split sysfile.sys
+  call assert_equal('sys', &filetype)
+  unlet g:filetype_sys
+  bwipe!
+
   " RAPID header start with a line containing only "%%%", 
   " but is not always present.
   call writefile(['%%%'], 'sysfile.sys')
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4747,
+/**/
     4746,
 /**/
     4745,