mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
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 <knosowski@graeffrobotics.de>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
23b4b55364
commit
dec3d6c7da
Vendored
+18
-2
@@ -3,7 +3,7 @@ vim9script
|
||||
# Vim functions for file type detection
|
||||
#
|
||||
# Maintainer: The Vim Project <https://github.com/vim/vim>
|
||||
# Last Change: 2026 May 28
|
||||
# Last Change: 2026 May 29
|
||||
# Former Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
|
||||
# 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
|
||||
|
||||
@@ -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|
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim support file to detect file types
|
||||
"
|
||||
" Maintainer: The Vim Project <https://github.com/vim/vim>
|
||||
" Last Change: 2026 Apr 20
|
||||
" Last Change: 2026 May 29
|
||||
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
|
||||
" 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") |
|
||||
|
||||
@@ -434,6 +434,7 @@ def s:GetFilenameChecks(): dict<list<string>>
|
||||
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
|
||||
|
||||
@@ -729,6 +729,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
557,
|
||||
/**/
|
||||
556,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user