summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvidSeeker <avidseeker7@protonmail.com>2024-07-16 21:39:07 +0200
committerChristian Brabandt <cb@256bit.org>2024-07-16 21:42:17 +0200
commit3088ef094da721dac8c0363a6c9e14eaf9313929 (patch)
treebdc4aa5b11821f36412ecf6a5612d3f86af10778
parentbabea52f4d2d7cf466c5b383a067078392b153dc (diff)
patch 9.1.0593: filetype: Asymptote files are not recognizedv9.1.0593
Problem: filetype: Asymptote files are not recognized Solution: detect '*.asy' files as asy filetype, include ftplugin and syntax plugin (AvidSeeker). Reference: https://asymptote.sourceforge.io/ closes: #15252 Signed-off-by: AvidSeeker <avidseeker7@protonmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--.github/MAINTAINERS2
-rw-r--r--runtime/doc/syntax.txt19
-rw-r--r--runtime/doc/tags5
-rw-r--r--runtime/filetype.vim3
-rw-r--r--runtime/ftplugin/asy.vim14
-rw-r--r--runtime/syntax/asy.vim243
-rw-r--r--src/testdir/test_filetype.vim1
-rw-r--r--src/version.c2
8 files changed, 289 insertions, 0 deletions
diff --git a/.github/MAINTAINERS b/.github/MAINTAINERS
index eb94cb715a..c4cab55ff4 100644
--- a/.github/MAINTAINERS
+++ b/.github/MAINTAINERS
@@ -113,6 +113,7 @@ runtime/ftplugin/antlr4.vim @jiangyinzuo
runtime/ftplugin/apache.vim @dubgeiser
runtime/ftplugin/arduino.vim @k-takata
runtime/ftplugin/astro.vim @romainl
+runtime/ftplugin/asy.vim @avidseeker
runtime/ftplugin/awk.vim @dkearns
runtime/ftplugin/basic.vim @dkearns
runtime/ftplugin/bst.vim @tpope
@@ -382,6 +383,7 @@ runtime/syntax/asm.vim @dkearns
runtime/syntax/asmh8300.vim @dkearns
runtime/syntax/asterisk.vim @jaunis
runtime/syntax/astro.vim @wuelnerdotexe
+runtime/syntax/asy.vim @avidseeker
runtime/syntax/autohotkey.vim @mmikeww
runtime/syntax/awk.vim @dkearns
runtime/syntax/basic.vim @dkearns
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 0bbba4db6f..2dfc5b6282 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -958,6 +958,25 @@ For Visual Basic use: >
:let g:filetype_asa = "aspvbs"
:let g:filetype_asp = "aspvbs"
+ASYMPTOTE *asy.vim* *ft-asy-syntax*
+
+By default, only basic Asymptote keywords are highlighted. To highlight
+extended geometry keywords: >
+
+ :let g:asy_syn_plain = 1
+
+and for highlighting keywords related to 3D constructions: >
+
+ :let g:asy_syn_three = 1
+
+By default, Asymptote-defined colors (e.g: lightblue) are highlighted. To
+highlight TeX-defined colors (e.g: BlueViolet) use: >
+
+ :let g:asy_syn_texcolors = 1
+
+or for Xorg colors (e.g: AliceBlue): >
+
+ :let g:asy_syn_x11colors = 1
BAAN *baan.vim* *baan-syntax*
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 4e096ec12d..5c44174cd7 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -6065,6 +6065,7 @@ assert_notmatch() testing.txt /*assert_notmatch()*
assert_report() testing.txt /*assert_report()*
assert_true() testing.txt /*assert_true()*
astro.vim syntax.txt /*astro.vim*
+asy.vim syntax.txt /*asy.vim*
at motion.txt /*at*
atan() builtin.txt /*atan()*
atan2() builtin.txt /*atan2()*
@@ -7253,6 +7254,7 @@ ft-asmh8300-syntax syntax.txt /*ft-asmh8300-syntax*
ft-aspperl-syntax syntax.txt /*ft-aspperl-syntax*
ft-aspvbs-syntax syntax.txt /*ft-aspvbs-syntax*
ft-astro-syntax syntax.txt /*ft-astro-syntax*
+ft-asy-syntax syntax.txt /*ft-asy-syntax*
ft-awk-plugin filetype.txt /*ft-awk-plugin*
ft-bash-syntax syntax.txt /*ft-bash-syntax*
ft-basic-syntax syntax.txt /*ft-basic-syntax*
@@ -7299,7 +7301,9 @@ ft-fortran-syntax syntax.txt /*ft-fortran-syntax*
ft-freebasic-plugin filetype.txt /*ft-freebasic-plugin*
ft-freebasic-syntax syntax.txt /*ft-freebasic-syntax*
ft-fvwm-syntax syntax.txt /*ft-fvwm-syntax*
+ft-gdscript-plugin filetype.txt /*ft-gdscript-plugin*
ft-gitcommit-plugin filetype.txt /*ft-gitcommit-plugin*
+ft-go-plugin filetype.txt /*ft-go-plugin*
ft-gprof-plugin filetype.txt /*ft-gprof-plugin*
ft-groff-syntax syntax.txt /*ft-groff-syntax*
ft-gsp-syntax syntax.txt /*ft-gsp-syntax*
@@ -7335,6 +7339,7 @@ ft-markdown-syntax syntax.txt /*ft-markdown-syntax*
ft-masm-syntax syntax.txt /*ft-masm-syntax*
ft-mathematica-syntax syntax.txt /*ft-mathematica-syntax*
ft-matlab-indent indent.txt /*ft-matlab-indent*
+ft-mediawiki-syntax syntax.txt /*ft-mediawiki-syntax*
ft-metafont ft_mp.txt /*ft-metafont*
ft-metafont-intro ft_mp.txt /*ft-metafont-intro*
ft-metafont-mappings ft_mp.txt /*ft-metafont-mappings*
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 3578e01c1e..2ec0589b53 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -111,6 +111,9 @@ au BufNewFile,BufRead *.ino,*.pde setf arduino
" Ash of busybox
au BufNewFile,BufRead .ash_history setf sh
+" Asymptote
+au BufNewFile,BufRead *.asy setf asy
+
" Apache config file
au BufNewFile,BufRead .htaccess,*/etc/httpd/*.conf setf apache
au BufNewFile,BufRead */etc/apache2/sites-*/*.com setf apache
diff --git a/runtime/ftplugin/asy.vim b/runtime/ftplugin/asy.vim
new file mode 100644
index 0000000000..76bd69d202
--- /dev/null
+++ b/runtime/ftplugin/asy.vim
@@ -0,0 +1,14 @@
+" Vim filetype plugin
+" Language: Asymptote
+" Maintainer: AvidSeeker <avidseeker7@protonmail.com>
+" Last Change: 2024 Jul 13
+"
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let g:did_ftplugin = 1
+
+setlocal commentstring=/*\ %s\ */
+
+let b:undo_ftplugin = "setl commentstring<"
diff --git a/runtime/syntax/asy.vim b/runtime/syntax/asy.vim
new file mode 100644
index 0000000000..ed2bf712f5
--- /dev/null
+++ b/runtime/syntax/asy.vim
@@ -0,0 +1,243 @@
+" Vim syntax file
+" Language: Asymptote
+" Maintainer: Avid Seeker <avidseeker7@protonmail.com>
+" Andy Hammerlindl
+" Last Change: 2022 Jan 05
+
+" Hacked together from Bram Moolenaar's C syntax file, and Claudio Fleiner's
+" Java syntax file.
+
+if exists("b:current_syntax")
+ finish
+endif
+
+" useful C/C++/Java keywords
+syn keyword asyStatement break return continue unravel
+syn keyword asyConditional if else
+syn keyword asyRepeat while for do
+syn keyword asyExternal access from import include
+syn keyword asyOperator new operator
+
+" basic asymptote keywords
+syn keyword asyConstant VERSION
+syn keyword asyConstant true false default infinity inf nan
+syn keyword asyConstant null nullframe nullpath nullpen
+syn keyword asyConstant intMin intMax realMin realMax
+syn keyword asyConstant realEpsilon realDigits
+syn keyword asyPathSpec and cycle controls tension atleast curl
+syn keyword asyStorageClass static public restricted private explicit
+syn keyword asyStructure struct typedef
+syn keyword asyType void bool bool3 int real string file
+syn keyword asyType pair triple transform guide path pen frame
+syn keyword asyType picture
+
+" module specific keywords
+if exists("asy_syn_plain")
+ syn keyword asyConstant currentpicture currentpen defaultpen
+ syn keyword asyConstant inch inches cm mm bp pt up down right left
+ syn keyword asyConstant E NE N NW W SW S SE
+ syn keyword asyConstant ENE NNE NNW WNW WSW SSW SSE ESE
+ syn keyword asyConstant I pi twopi
+ syn keyword asyConstant CCW CW
+ syn keyword asyConstant undefined sqrtEpsilon Align mantissaBits
+ syn keyword asyConstant identity zeroTransform invert
+ syn keyword asyConstant stdin stdout
+ syn keyword asyConstant unitsquare unitcircle circleprecision
+ syn keyword asyConstant solid dotted Dotted dashed dashdotted
+ syn keyword asyConstant longdashed longdashdotted
+ syn keyword asyConstant squarecap roundcap extendcap
+ syn keyword asyConstant miterjoin roundjoin beveljoin
+ syn keyword asyConstant zerowinding evenodd basealign nobasealign
+ syn keyword asyConstant black white gray red green blue Cyan Magenta
+ syn keyword asyConstant Yellow Black cyan magenta yellow palered
+ syn keyword asyConstant palegreen paleblue palecyan palemagenta
+ syn keyword asyConstant paleyellow palegray lightred lightgreen
+ syn keyword asyConstant lightblue lightcyan lightmagenta lightyellow
+ syn keyword asyConstant lightgray mediumred mediumgreen mediumblue
+ syn keyword asyConstant mediumcyan mediummagenta mediumyellow
+ syn keyword asyConstant mediumgray heavyred heavygreen heavyblue
+ syn keyword asyConstant heavycyan heavymagenta lightolive heavygray
+ syn keyword asyConstant deepred deepgreen deepblue deepcyan
+ syn keyword asyConstant deepmagenta deepyellow deepgray darkred
+ syn keyword asyConstant darkgreen darkblue darkcyan darkmagenta
+ syn keyword asyConstant darkolive darkgray orange fuchsia chartreuse
+ syn keyword asyConstant springgreen purple royalblue salmon brown
+ syn keyword asyConstant olive darkbrown pink palegrey lightgrey
+ syn keyword asyConstant mediumgrey grey heavygrey deepgrey darkgrey
+
+ if exists("asy_syn_texcolors")
+ syn keyword asyConstant GreenYellow Yellow Goldenrod Dandelion
+ syn keyword asyConstant Apricot Peach Melon YellowOrange Orange
+ syn keyword asyConstant BurntOrange Bittersweet RedOrange Mahogany
+ syn keyword asyConstant Maroon BrickRed Red OrangeRed RubineRed
+ syn keyword asyConstant WildStrawberry Salmon CarnationPink Magenta
+ syn keyword asyConstant VioletRed Rhodamine Mulberry RedViolet
+ syn keyword asyConstant Fuchsia Lavender Thistle Orchid DarkOrchid
+ syn keyword asyConstant Purple Plum Violet RoyalPurple BlueViolet
+ syn keyword asyConstant Periwinkle CadetBlue CornflowerBlue
+ syn keyword asyConstant MidnightBlue NavyBlue RoyalBlue Blue
+ syn keyword asyConstant Cerulean Cyan ProcessBlue SkyBlue Turquoise
+ syn keyword asyConstant TealBlue Aquamarine BlueGreen Emerald
+ syn keyword asyConstant JungleGreen SeaGreen Green ForestGreen
+ syn keyword asyConstant PineGreen LimeGreen YellowGreen SpringGreen
+ syn keyword asyConstant OliveGreen RawSienna Sepia Brown Tan Gray
+ syn keyword asyConstant Black White
+ endif
+
+ if exists("asy_syn_x11colors")
+ syn keyword asyConstant AliceBlue AntiqueWhite Aqua Aquamarine Azure
+ syn keyword asyConstant Beige Bisque Black BlanchedAlmond Blue
+ syn keyword asyConstant BlueViolet Brown BurlyWood CadetBlue
+ syn keyword asyConstant Chartreuse Chocolate Coral CornflowerBlue
+ syn keyword asyConstant Cornsilk Crimson Cyan DarkBlue DarkCyan
+ syn keyword asyConstant DarkGoldenrod DarkGray DarkGreen DarkKhaki
+ syn keyword asyConstant DarkMagenta DarkOliveGreen DarkOrange
+ syn keyword asyConstant DarkOrchid DarkRed DarkSalmon DarkSeaGreen
+ syn keyword asyConstant DarkSlateBlue DarkSlateGray DarkTurquoise
+ syn keyword asyConstant DarkViolet DeepPink DeepSkyBlue DimGray
+ syn keyword asyConstant DodgerBlue FireBrick FloralWhite ForestGreen
+ syn keyword asyConstant Fuchsia Gainsboro GhostWhite Gold Goldenrod
+ syn keyword asyConstant Gray Green GreenYellow Honeydew HotPink
+ syn keyword asyConstant IndianRed Indigo Ivory Khaki Lavender
+ syn keyword asyConstant LavenderBlush LawnGreen LemonChiffon
+ syn keyword asyConstant LightBlue LightCoral LightCyan
+ syn keyword asyConstant LightGoldenrodYellow LightGreen LightGrey
+ syn keyword asyConstant LightPink LightSalmon LightSeaGreen
+ syn keyword asyConstant LightSkyBlue LightSlateGray LightSteelBlue
+ syn keyword asyConstant LightYellow Lime LimeGreen Linen Magenta
+ syn keyword asyConstant Maroon MediumAquamarine MediumBlue
+ syn keyword asyConstant MediumOrchid MediumPurple MediumSeaGreen
+ syn keyword asyConstant MediumSlateBlue MediumSpringGreen
+ syn keyword asyConstant MediumTurquoise MediumVioletRed MidnightBlue
+ syn keyword asyConstant MintCream MistyRose Moccasin NavajoWhite
+ syn keyword asyConstant Navy OldLace Olive OliveDrab Orange
+ syn keyword asyConstant OrangeRed Orchid PaleGoldenrod PaleGreen
+ syn keyword asyConstant PaleTurquoise PaleVioletRed PapayaWhip
+ syn keyword asyConstant PeachPuff Peru Pink Plum PowderBlue Purple
+ syn keyword asyConstant Red RosyBrown RoyalBlue SaddleBrown Salmon
+ syn keyword asyConstant SandyBrown SeaGreen Seashell Sienna Silver
+ syn keyword asyConstant SkyBlue SlateBlue SlateGray Snow SpringGreen
+ syn keyword asyConstant SteelBlue Tan Teal Thistle Tomato Turquoise
+ syn keyword asyConstant Violet Wheat White WhiteSmoke Yellow
+ syn keyword asyConstant YellowGreen
+ endif
+
+ if exists("asy_syn_three")
+ syn keyword asyType path3 guide3 transform3
+ syn keyword asyType projection light material patch surface tube
+ syn keyword asyConstant currentprojection currentlight defaultrender
+ syn keyword asyConstant identity4 O X Y Z
+ syn keyword asyConstant nolight nullpens
+ syn keyword asyConstant unitsphere unithemisphere unitplane octant1
+ syn keyword asyConstant unitcone unitsolidcone unitcube unitcylinder
+ syn keyword asyConstant unitdisk unittube
+ endif
+endif
+
+
+" string constants
+syn region asyCString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=asyCSpecial
+syn match asyCSpecial display contained +\\\(['"?\\abfnrtv]\|\o\{1,3}\)+
+syn match asyCSpecial display contained +\\\(x[0-9A-F]\{1,2\}\|$\)+
+" double quoted strings only special character is \"
+syn region asyString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=asySpecial
+syn match asySpecial display contained +\(\\\)\@1<!\(\\\\\)*\zs\\"+
+
+
+" number constants
+syn match asyNumbers display transparent "\<\d\|\.\d"
+ \ contains=asyNumber,asyNumberError
+syn match asyNumber display contained "\d*\.\=\d*\(e[-+]\=\d\+\)\="
+" highlight number constants with two '.' or with '.' after an 'e'
+syn match asyNumberError display contained "\d*\.\(\d\|e[-+]\=\)*\.[0-9.]*"
+syn match asyNumberError display contained "\d*e[-+]\=\d*\.[0-9.]*"
+syn match asyNumberError display contained "\d*e[-+]\=\(e[-+]\=\)*\.[0-9.]*"
+
+
+" comments and comment strings
+syn keyword asyTodo contained TODO FIXME XXX
+syn sync ccomment asyComment minlines=15
+if exists("asy_comment_strings")
+ " A comment can contain asyString, asyCString, and asyNumber. But a "*/"
+ " inside a asy*String in a asyComment DOES end the comment! So we need to
+ " use a special type of asy*String: asyComment*String, which also ends on
+ " "*/", and sees a "*" at the start of the line as comment again.
+ " Unfortunately this doesn't very well work for // type of comments :-(
+ syn match asyCommentSkip contained "^\s*\*\($\|\s\+\)"
+ syn region asyCommentString contained start=+"+ skip=+\\\\\|\\"+ end=+"+
+ \ end=+\*/+me=s-1
+ \ contains=asySpecial,asyCommentSkip
+ syn region asyCommentCString contained start=+'+ skip=+\\\\\|\\'+ end=+'+
+ \ end=+\*/+me=s-1
+ \ contains=asyCSpecial,asyCommentSkip
+ syn region asyCommentLString contained start=+"+ skip=+\\\\\|\\"+ end=+"+
+ \ end="$" contains=asySpecial
+ syn region asyCommentLCString contained start=+'+ skip=+\\\\\|\\'+ end=+'+
+ \ end="$" contains=asyCSpecial
+ syn region asyCommentL start="//" skip="\\$" end="$" keepend
+ \ contains=asyTodo,asyCommentLString,
+ \ asyCommentLCString,asyNumbers
+ syn region asyComment matchgroup=asyComment start="/\*" end="\*/"
+ \ contains=asyTodo,asyCommentStartError,
+ \ asyCommentString,asyCommentCString,asyNumbers
+else
+ syn region asyCommentL start="//" skip="\\$" end="$" keepend
+ \ contains=asyTodo
+ syn region asyComment matchgroup=asyComment start="/\*" end="\*/"
+ \ contains=asyTodo,asyCommentStartError
+endif
+
+" highlight common errors when starting/ending C comments
+syn match asyCommentError display "\*/"
+syn match asyCommentStartError display "/\*"me=e-1 contained
+
+
+" delimiter matching errors
+syn region asyCurly transparent start='{' end='}'
+ \ contains=TOP,asyCurlyError
+syn region asyBrack transparent start='\[' end='\]' matchgroup=asyError
+ \ end=';' contains=TOP,asyBrackError
+syn region asyParen transparent start='(' end=')' matchgroup=asyError
+ \ end=';' contains=TOP,asyParenError
+syn match asyCurlyError display '}'
+syn match asyBrackError display '\]'
+syn match asyParenError display ')'
+" for (;;) constructs are exceptions that allow ; inside parenthesis
+syn region asyParen transparent matchgroup=asyParen
+ \ start='\(for\s*\)\@<=(' end=')'
+ \ contains=TOP,asyParenError
+
+" Define the default highlighting.
+hi def link asyCommentL asyComment
+hi def link asyConditional Conditional
+hi def link asyRepeat Repeat
+hi def link asyNumber Number
+hi def link asyNumberError asyError
+hi def link asyCurlyError asyError
+hi def link asyBracketError asyError
+hi def link asyParenError asyError
+hi def link asyCommentError asyError
+hi def link asyCommentStartError asyError
+hi def link asyOperator Operator
+hi def link asyStructure Structure
+hi def link asyStorageClass StorageClass
+hi def link asyExternal Include
+hi def link asyDefine Macro
+hi def link asyError Error
+hi def link asyStatement Statement
+hi def link asyType Type
+hi def link asyConstant Constant
+hi def link asyCommentString asyString
+hi def link asyCommentCString asyString
+hi def link asyCommentLString asyString
+hi def link asyCommentLCString asyString
+hi def link asyCommentSkip asyComment
+hi def link asyString String
+hi def link asyCString String
+hi def link asyComment Comment
+hi def link asySpecial SpecialChar
+hi def link asyCSpecial SpecialChar
+hi def link asyTodo Todo
+hi def link asyPathSpec Statement
+
+let b:current_syntax = "asy"
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
index 9e66a7c674..c3c0139c2b 100644
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -107,6 +107,7 @@ def s:GetFilenameChecks(): dict<list<string>>
asn: ['file.asn', 'file.asn1'],
asterisk: ['asterisk/file.conf', 'asterisk/file.conf-file', 'some-asterisk/file.conf', 'some-asterisk/file.conf-file'],
astro: ['file.astro'],
+ asy: ['file.asy'],
atlas: ['file.atl', 'file.as'],
authzed: ['schema.zed'],
autohotkey: ['file.ahk'],
diff --git a/src/version.c b/src/version.c
index c6b6248878..49aeb92f7a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 593,
+/**/
592,
/**/
591,