From: KnoP-01 Date: Fri, 29 May 2026 17:46:36 +0000 (+0000) Subject: patch 9.2.0557: filetype: Kawasaki Robots files are not recognized X-Git-Tag: v9.2.0557^0 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=dec3d6c7da637de5717c27d24a2f7ca50f7180a3;p=thirdparty%2Fvim.git patch 9.2.0557: filetype: Kawasaki Robots files are not recognized Problem: filetype: Kawasaki Robots files are not recognized Solution: Detect *.pg as kawasaki_as filetype, add filetype detection for *.as as atlas or kawasaki_as filetype (KnoP-01). In Kawasaki robots (https://kawasakirobotics.com/products-robots/) AS language *.pg is the extention for a program file and *.as is for a complete backup. closes: #20370 Signed-off-by: KnoP-01 Signed-off-by: Christian Brabandt --- diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index 3b585b61d2..9419cf58a5 100644 --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -3,7 +3,7 @@ vim9script # Vim functions for file type detection # # Maintainer: The Vim Project -# Last Change: 2026 May 28 +# Last Change: 2026 May 29 # Former Maintainer: Bram Moolenaar # These functions are moved here from runtime/filetype.vim to make startup @@ -63,6 +63,21 @@ export def FTapp() endfor enddef +# This function checks for Kawasaki robots AS file or atlas file type. +export def FTas() + if exists("g:filetype_as") + exe "setf " .. g:filetype_as + return + endif + for lnum in range(1, min([line("$"), 30])) + if getline(lnum) =~ '^\.NETCONF' + setf kawasaki_as + return + endif + endfor + setf atlas +enddef + # This function checks for the kind of assembly that is wanted by the user, or # can be detected from the beginning of the file. export def FTasm() @@ -1771,7 +1786,6 @@ const ft_from_ext = { "astro": "astro", # Atlas "atl": "atlas", - "as": "atlas", # Atom is based on XML "atom": "xml", # Authzed @@ -2300,6 +2314,8 @@ const ft_from_ext = { # KAREL "kl": "karel", "KL": "karel", + # Kawasaki AS + "pg": "kawasaki_as", # KDL "kdl": "kdl", # KerML diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index 5078913e67..80c3bb810f 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -1,4 +1,4 @@ -*filetype.txt* For Vim version 9.2. Last change: 2026 May 16 +*filetype.txt* For Vim version 9.2. Last change: 2026 May 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -139,6 +139,7 @@ variables can be used to overrule the filetype used for certain extensions: file name variable ~ *.app g:filetype_app + *.as g:filetype_as *.asa g:filetype_asa |ft-aspperl-syntax| |ft-aspvbs-syntax| *.asm g:asmsyntax |ft-asm-syntax| diff --git a/runtime/filetype.vim b/runtime/filetype.vim index da632acc54..3590ebe97c 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: The Vim Project -" Last Change: 2026 Apr 20 +" Last Change: 2026 May 29 " Former Maintainer: Bram Moolenaar " If the filetype can be detected from extension or file name(the final path component), @@ -91,6 +91,9 @@ au BufNewFile,BufRead */.aptitude/config setf aptconf " Arch Inventory file au BufNewFile,BufRead .arch-inventory,=tagging-method setf arch +" atlas or kawasaki_as +au BufNewFile,BufRead *.as call dist#ft#FTas() + " Active Server Pages (with Visual Basic Script) au BufNewFile,BufRead *.asa \ if exists("g:filetype_asa") | diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index aefdef1b57..5eb08f277d 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -434,6 +434,7 @@ def s:GetFilenameChecks(): dict> julia: ['file.jl'], just: ['justfile', 'Justfile', '.justfile', 'config.just'], karel: ['file.kl', 'file.KL'], + kawasaki_as: ['file.pg'], kconfig: ['Kconfig', 'Kconfig.debug', 'Kconfig.file', 'Config.in', 'Config.in.host'], kdl: ['file.kdl'], kerml: ['file.kerml'], @@ -3540,4 +3541,19 @@ func Test_cucumber_code_injection() filetype plugin off endfunc +func Test_as_file() + filetype on + + call writefile([], 'Xfile.as', 'D') + split Xfile.as + call assert_equal('atlas', &filetype) + bwipe! + call writefile(['', '.NETCONF'], 'Xfile.as', 'D') + split Xfile.as + call assert_equal('kawasaki_as', &filetype) + bwipe! + + filetype off +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index d17b4d5868..685887351a 100644 --- a/src/version.c +++ b/src/version.c @@ -729,6 +729,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 557, /**/ 556, /**/