summaryrefslogtreecommitdiffstats
path: root/runtime/syntax
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-05-14 18:50:25 +0100
committerBram Moolenaar <Bram@vim.org>2023-05-14 18:50:25 +0100
commitb7398fe41c9e1e731d058105a34158871ee83e3f (patch)
treed1d20b18bffd1bc554fbe0212eee3643adacda54 /runtime/syntax
parente5d91ba1de83949eb9357c0fb8cbd91e7e69be6f (diff)
Update runtime files
Diffstat (limited to 'runtime/syntax')
-rw-r--r--runtime/syntax/dts.vim5
-rw-r--r--runtime/syntax/luau.vim15
-rw-r--r--runtime/syntax/nasm.vim72
-rw-r--r--runtime/syntax/vim.vim30
-rw-r--r--runtime/syntax/xpm.vim181
5 files changed, 197 insertions, 106 deletions
diff --git a/runtime/syntax/dts.vim b/runtime/syntax/dts.vim
index be51ab5b10..bb7eff7be1 100644
--- a/runtime/syntax/dts.vim
+++ b/runtime/syntax/dts.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: dts/dtsi (device tree files)
" Maintainer: Daniel Mack <vim@zonque.org>
-" Last Change: 2022 Jun 14
+" Last Change: 2023 Apr 28
if exists("b:current_syntax")
finish
@@ -10,9 +10,10 @@ let b:current_syntax = 'dts'
syntax region dtsComment start="/\*" end="\*/"
syntax match dtsReference "&[[:alpha:][:digit:]_]\+"
+syntax match dtsReference "&{[[:alpha:][:digit:]@_/-]\+}"
syntax region dtsBinaryProperty start="\[" end="\]"
syntax match dtsStringProperty "\".*\""
-syntax match dtsKeyword "/.\{-1,\}/"
+syntax match dtsKeyword "/[[:alpha:][:digit:]-]\+/\([[:space:]]\|;\)"he=e-1
syntax match dtsLabel "^[[:space:]]*[[:alpha:][:digit:]_]\+:"
syntax match dtsNode /[[:alpha:][:digit:]-_]\+\(@[0-9a-fA-F]\+\|\)[[:space:]]*{/he=e-1
syntax region dtsCellProperty start="<" end=">" contains=dtsReference,dtsBinaryProperty,dtsStringProperty,dtsComment
diff --git a/runtime/syntax/luau.vim b/runtime/syntax/luau.vim
new file mode 100644
index 0000000000..59eccac100
--- /dev/null
+++ b/runtime/syntax/luau.vim
@@ -0,0 +1,15 @@
+" Vim syntax file
+" Language: Luau
+" Maintainer: None yet
+" Last Change: 2023 Apr 30
+
+if exists("b:current_syntax")
+ finish
+endif
+
+" Luau is a superset of lua
+runtime! syntax/lua.vim
+
+let b:current_syntax = "luau"
+
+" vim: nowrap sw=2 sts=2 ts=8 noet:
diff --git a/runtime/syntax/nasm.vim b/runtime/syntax/nasm.vim
index d763033225..0eb82fad10 100644
--- a/runtime/syntax/nasm.vim
+++ b/runtime/syntax/nasm.vim
@@ -3,8 +3,12 @@
" Maintainer: Andrii Sokolov <andriy145@gmail.com>
" Original Author: Manuel M.H. Stol <Manuel.Stol@allieddata.nl>
" Former Maintainer: Manuel M.H. Stol <Manuel.Stol@allieddata.nl>
-" Contributors: Leonard König <leonard.r.koenig@gmail.com> (C string highlighting), Peter Stanhope <dev.rptr@gmail.com> (Add missing 64-bit mode registers)
-" Last Change: 2017 Jan 23
+" Contributors:
+" Leonard König <leonard.r.koenig@gmail.com> (C string highlighting),
+" Peter Stanhope <dev.rptr@gmail.com> (Add missing 64-bit mode registers)
+" Frédéric Hamel <rederic.hamel123@gmail.com> (F16c support, partial AVX
+" support, other)
+" Last Change: 2022 May 3
" NASM Home: http://www.nasm.us/
@@ -277,7 +281,7 @@ syn match nasmInstrModifier "\<F\(ADD\|MUL\|\(DIV\|SUB\)R\=\)\s\+TO\>"lc=5,ms=
" NAsm directives
syn keyword nasmRepeat TIMES
syn keyword nasmDirective ALIGN[B] INCBIN EQU NOSPLIT SPLIT
-syn keyword nasmDirective ABSOLUTE BITS SECTION SEGMENT
+syn keyword nasmDirective ABSOLUTE BITS SECTION SEGMENT DEFAULT
syn keyword nasmDirective ENDSECTION ENDSEGMENT
syn keyword nasmDirective __SECT__
" Macro created standard directives: (requires %include)
@@ -309,7 +313,7 @@ syn match nasmStdInstruction "\<\(CMOV\|J\|SET\)\(N\=\([ABGL]E\=\|[CEOSZ]\)\|P
syn match nasmStdInstruction "\<POP\>"
syn keyword nasmStdInstruction AAA AAD AAM AAS ADC ADD AND
syn keyword nasmStdInstruction BOUND BSF BSR BSWAP BT[C] BTR BTS
-syn keyword nasmStdInstruction CALL CBW CDQ CLC CLD CMC CMP CMPSB CMPSD CMPSW CMPSQ
+syn keyword nasmStdInstruction CALL CBW CDQ CDQE CLC CLD CMC CMP CMPSB CMPSD CMPSW CMPSQ
syn keyword nasmStdInstruction CMPXCHG CMPXCHG8B CPUID CWD[E] CQO
syn keyword nasmStdInstruction DAA DAS DEC DIV ENTER
syn keyword nasmStdInstruction IDIV IMUL INC INT[O] IRET[D] IRETW IRETQ
@@ -319,6 +323,7 @@ syn keyword nasmStdInstruction LODSW LOOP[E] LOOPNE LOOPNZ LOOPZ LSS
syn keyword nasmStdInstruction MOVSB MOVSD MOVSW MOVSX MOVSQ MOVZX MUL NEG NOP NOT
syn keyword nasmStdInstruction OR POPA[D] POPAW POPF[D] POPFW POPFQ
syn keyword nasmStdInstruction PUSH[AD] PUSHAW PUSHF[D] PUSHFW PUSHFQ
+syn keyword nasmStdInstruction PAUSE
syn keyword nasmStdInstruction RCL RCR RETF RET[N] ROL ROR
syn keyword nasmStdInstruction SAHF SAL SAR SBB SCASB SCASD SCASW
syn keyword nasmStdInstruction SHL[D] SHR[D] STC STD STOSB STOSD STOSW STOSQ SUB
@@ -405,6 +410,62 @@ syn keyword nasmSseInstruction ORPS RCPPS RCPSS RSQRTPS RSQRTSS
syn keyword nasmSseInstruction SHUFPS SQRTPS SQRTSS STMXCSR SUBPS SUBSS
syn keyword nasmSseInstruction UCOMISS UNPCKHPS UNPCKLPS XORPS
+" F16c Instructions
+syn keyword nasmF16CInstruction VCVTPH2PS VCVTPS2PH
+
+" AVX Instructions
+syn keyword nasmAVXInstruction VCVTDQ2PD VCVTDQ2PS VCVTPD2DQ VCVTPD2P VCVTPD2PS
+syn keyword nasmAVXInstruction VCVTPS2DQ VCVTPS2PD
+syn keyword nasmAVXInstruction VCVTSD2SI VCVTSD2SS VCVTSI2SD VCVTSI2SS VCVTSS2SD VCVTSS2SI
+syn keyword nasmAVXInstruction VMAXPS VMAXSS VMINPS VMINSS VMOVAPS VMOVHLPS VMOVHPS
+syn keyword nasmAVXInstruction VMAXPD VMAXSD VMINPD VMINSD VMOVAPD VMOVHLPD VMOVHPD
+syn keyword nasmAVXInstruction VMOVLHPS VMOVLPS VMOVMSKPS VMOVNTPS VMOVSS VMOVUPS
+syn keyword nasmAVXInstruction VMULPS VMULSS VPXOR
+
+syn match nasmInstructnError "\<VP\a\{3}R\a\>"
+syn match nasmAVXInstruction "\<VP\(INS\|EXT\)R[BDQW]\>"
+
+syn keyword nasmAVXInstruction VORPS VPABSB VPABSD VPABSW
+syn keyword nasmAVXInstruction PACKSSDW VPACKSSWB VPACKUSDW VPACKUSWB VPADDD
+syn keyword nasmAVXInstruction PADDQ VPADDSB VPADDSW VPADDUSB VPADDUSW
+syn keyword nasmAVXInstruction PADDW VPALIGNR VPAND VPANDN VPAVGB
+syn keyword nasmAVXInstruction PAVGW VPBLENDD VPBLENDVB VPBLENDW VPBROADCASTB
+syn keyword nasmAVXInstruction PBROADCASTD VPBROADCASTQ VPBROADCASTW VPCLMULQDQ VPCMOV
+syn keyword nasmAVXInstruction PCMPEQB VPCMPEQD VPCMPEQQ VPCMPEQW VPCMPESTRI
+syn keyword nasmAVXInstruction PCMPESTRM VPCMPGTB VPCMPGTD VPCMPGTQ VPCMPGTW
+syn keyword nasmAVXInstruction PCMPISTRI VPCMPISTRM VPCOMB VPCOMD VPCOMQ
+syn keyword nasmAVXInstruction PCOMUB VPCOMUD VPCOMUQ VPCOMUW VPCOMW
+syn keyword nasmAVXInstruction PERM2FVPERM2IVPERMD VPERMIL2PD VPERMIL2PS VPERMILPD VPERMILPS
+syn keyword nasmAVXInstruction PERMPD VPERMPS VPERMQ VPEXTRB VPEXTRD
+syn keyword nasmAVXInstruction PEXTRQ VPEXTRW VPGATHERDD VPGATHERDQ VPGATHERQD
+syn keyword nasmAVXInstruction PGATHERQQ VPHADDBD VPHADDBQ VPHADDBW VPHADDD
+syn keyword nasmAVXInstruction PHADDDQ VPHADDSW VPHADDUBQ VPHADDUBW VPHADDUDQ
+syn keyword nasmAVXInstruction PHADDUWD VPHADDUWQ VPHADDW VPHADDWD VPHADDWQ
+syn keyword nasmAVXInstruction PHMINPOSUW VPHSUBBW VPHSUBD VPHSUBDQ VPHSUBSW
+syn keyword nasmAVXInstruction PHSUBW VPHSUBWD VPINSRB VPINSRD VPINSRQ
+syn keyword nasmAVXInstruction PINSRW VPMACSDD VPMACSDQH
+syn keyword nasmAVXInstruction VPMACSDQL VPMACSSDD VPMACSSDQL VPMACSSQH VPMACSSWD
+syn keyword nasmAVXInstruction VPMACSSWW VPMACSWD VPMACSWW VPMADCSSWD VPMADCSWD
+syn keyword nasmAVXInstruction VPMADDUBSW VPMADDWD VPMASKMOVD VPMASKMOVQ VPMAXSB
+syn keyword nasmAVXInstruction VPMAXSD VPMAXSW VPMAXUB VPMAXUD VPMAXUW
+syn keyword nasmAVXInstruction VPMINSB VPMINSD VPMINSW VPMINUB VPMINUD
+syn keyword nasmAVXInstruction VPMINUW VPMOVMSKB VPMOVSXBD VPMOVSXBQ VPMOVSXBW
+syn keyword nasmAVXInstruction VPMOVSXDQ VPMOVSXWD VPMOVSXWQ VPMOVZXBD VPMOVZXBQ
+syn keyword nasmAVXInstruction VPMOVZXBW VPMOVZXDQ VPMOVZXWD VPMOVZXWQ VPMULDQ
+syn keyword nasmAVXInstruction VPMULHRSW VPMULHUW VPMULHW VPMULLD VPMULLW
+syn keyword nasmAVXInstruction VPMULUDQ VPOR VPPERM VPROTB VPROTD
+syn keyword nasmAVXInstruction VPROTQ VPROTW VPSADBW VPSHAB VPSHAD
+syn keyword nasmAVXInstruction VPSHAQ VPSHAW VPSHLB VPSHLD VPSHLQ
+syn keyword nasmAVXInstruction VPSHLW VPSHUFB VPSHUFD VPSHUFHW VPSHUFLW
+syn keyword nasmAVXInstruction VPSIGNB VPSIGND VPSIGNW VPSLLD VPSLLDQ
+syn keyword nasmAVXInstruction VPSLLQ VPSLLVD VPSLLVQ VPSLLW VPSRAD
+syn keyword nasmAVXInstruction VPSRAVD VPSRAW VPSRLD VPSRLDQ VPSRLQ
+syn keyword nasmAVXInstruction VPSRLVD VPSRLVQ VPSRLW VPSUBB VPSUBD
+syn keyword nasmAVXInstruction VPSUBQ VPSUBSB VPSUBSW VPSUBUSB VPSUBUSW
+syn keyword nasmAVXInstruction VPSUBW VPTEST VPUNPCKHBW VPUNPCKHDQ VPUNPCKHQDQ
+syn keyword nasmAVXInstruction VPUNPCKHWD VPUNPCKLBW VPUNPCKLDQ VPUNPCKLQDQ VPUNPCKLWD
+syn keyword nasmAVXInstruction VPXOR VRCPPS
+
" Three Dimensional Now Packed Instructions: (requires 3DNow! unit)
syn keyword nasmNowInstruction FEMMS PAVGUSB PF2ID PFACC PFADD PFCMPEQ PFCMPGE
@@ -515,13 +576,14 @@ hi def link nasmDbgInstruction Debug
hi def link nasmFpuInstruction Statement
hi def link nasmMmxInstruction Statement
hi def link nasmSseInstruction Statement
+hi def link nasmF16cInstruction Statement
+hi def link nasmAVXInstruction Statement
hi def link nasmNowInstruction Statement
hi def link nasmAmdInstruction Special
hi def link nasmCrxInstruction Special
hi def link nasmUndInstruction Todo
hi def link nasmInstructnError Error
-
let b:current_syntax = "nasm"
" vim:ts=8 sw=4
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 8db0f0e04b..d1ce01ec8d 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -1,8 +1,8 @@
" Vim syntax file
" Language: Vim 9.0 script
" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
-" Last Change: April 13, 2023
-" Version: 9.0-24
+" Last Change: May 09, 2023
+" Version: 9.0-25
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM
" Automatically generated keyword lists: {{{1
@@ -19,13 +19,13 @@ syn keyword vimTodo contained COMBAK FIXME TODO XXX
syn cluster vimCommentGroup contains=vimTodo,@Spell
" regular vim commands {{{2
-syn keyword vimCommand contained a ar[gs] argl[ocal] bad[d] bm[odified] breaka[dd] bun[load] cabc[lear] cal[l] cc cf[ile] changes cla[st] cnew[er] com cope[n] cscope debug delel delf[unction] dif[fupdate] difft[his] dli[st] ds[earch] echoc[onsole] elsei[f] endf[unction] enum exu[sage] fin[d] foldc[lose] go[to] ha[rdcopy] hid[e] if in iuna[bbrev] keepalt la[st] lan[guage] lbo[ttom] ld[o] lfdo lgrepa[dd] lma lo[adview] lop[en] lua m[ove] mes[sages] mod[e] nbs[tart] nor omapc[lear] packl[oadall] popu[p] profd[el] ptf[irst] pts[elect] py3f[ile] pythonx quita[ll] redraws[tatus] rew[ind] rubyf[ile] sIg sa[rgument] sba[ll] sbr[ewind] scl scscope sfir[st] sgl sic sin sm[ap] snoreme spelld[ump] spellw[rong] srg sta[g] stopi[nsert] sunmenu sync tab tabfir[st] tabp[revious] tcl th[row] tlnoremenu tn[ext] ts[elect] undoj[oin] up[date] vie[w] vne[w] win[size] wq xmapc[lear] xr[estore]
-syn keyword vimCommand contained ab arga[dd] argu[ment] balt bn[ext] breakd[el] bw[ipeout] cabo[ve] cat[ch] ccl[ose] cfdo chd[ir] class cnf[ile] comc[lear] cp[revious] cstag debugg[reedy] delep dell diffg[et] dig[raphs] do dsp[lit] echoe[rr] em[enu] endfo[r] eval f[ile] fina[lly] foldd[oopen] gr[ep] helpc[lose] his[tory] ij[ump] inor j[oin] keepj[umps] lab[ove] lat lc[d] le[ft] lfir[st] lh[elpgrep] lmak[e] loadk lp[revious] luado ma[rk] mk[exrc] mz[scheme] new nore on[ly] pc[lose] pp[op] promptf[ind] ptj[ump] pu[t] py3f[ile] pyx r[ead] redrawt[abline] ri[ght] rundo sIl sal[l] sbf[irst] sc scp se[t] sg sgn sie sip sme snoremenu spelli[nfo] spr[evious] sri star[tinsert] sts[elect] sus[pend] syncbind tabN[ext] tabl[ast] tabr[ewind] tcld[o] tj[ump] tlu tno[remap] tu[nmenu] undol[ist] v vim9[cmd] vs[plit] winc[md] wqa[ll] xme xunme
-syn keyword vimCommand contained abc[lear] argd[elete] as[cii] bd[elete] bo[tright] breakl[ist] cN[ext] cad[dbuffer] cb[uffer] cd cfir[st] che[ckpath] cle[arjumps] cnor comp[iler] cpf[ile] cun def deletel delm[arks] diffo[ff] dir doau e[dit] echom[sg] en[dif] endinterface ex files fini[sh] folddoc[losed] grepa[dd] helpf[ind] hor[izontal] il[ist] interface ju[mps] keepp[atterns] lad[dexpr] later lch[dir] lefta[bove] lg[etfile] lhi[story] lmapc[lear] loadkeymap lpf[ile] luafile mak[e] mks[ession] mzf[ile] nmapc[lear] nos[wapfile] opt[ions] pe[rl] pre[serve] promptr[epl] ptl[ast] public py[thon] pyxdo rec[over] reg[isters] rightb[elow] rv[iminfo] sIn san[dbox] sbl[ast] scI scr[iptnames] setf[iletype] sgI sgp sig sir smenu so[urce] spellr[are] sr srl startg[replace] substitutepattern sv[iew] syntime tabc[lose] tabm[ove] tabs tclf[ile] tl[ast] tlunmenu to[pleft] tunma[p] unh[ide] ve[rsion] vim9s[cript] wN[ext] windo wundo xmenu xunmenu
-syn keyword vimCommand contained abo[veleft] argded[upe] au bel[owright] bp[revious] bro[wse] cNf[ile] cadde[xpr] cbe[fore] cdo cg[etfile] checkt[ime] clo[se] co[py] con[tinue] cq[uit] cuna[bbrev] defc[ompile] deletep delp diffp[atch] disa[ssemble] doaut ea echon endclass endt[ry] exi[t] filet fir[st] foldo[pen] gui helpg[rep] i imapc[lear] intro k lN[ext] laddb[uffer] lb[uffer] lcl[ose] leg[acy] lgetb[uffer] ll lne[xt] loc[kmarks] lr[ewind] lv[imgrep] marks mksp[ell] n[ext] noa nu[mber] ownsyntax ped[it] prev[ious] ps[earch] ptn[ext] pw[d] pydo pyxfile red[o] res[ize] ru[ntime] sI sIp sav[eas] sbm[odified] sce scripte[ncoding] setg[lobal] sgc sgr sign sl[eep] smile sor[t] spellr[epall] srI srn startr[eplace] substituterepeat sw[apname] t tabd[o] tabn[ext] tags te[aroff] tlm tm[enu] tp[revious] type unl verb[ose] vim[grep] w[rite] winp[os] wv[iminfo] xnoreme xwininfo
-syn keyword vimCommand contained abstract argdo bN[ext] bf[irst] br[ewind] bufdo c[hange] caddf[ile] cbel[ow] ce[nter] cgetb[uffer] chi[story] cmapc[lear] col[der] conf[irm] cr[ewind] cw[indow] defer deletl dep diffpu[t] dj[ump] dp earlier echow[indow] enddef endw[hile] exp filetype fix[del] for gvim helpt[ags] ia imp is[earch] kee[pmarks] lNf[ile] laddf[ile] lbe[fore] lcs lex[pr] lgete[xpr] lla[st] lnew[er] lockv[ar] ls lvimgrepa[dd] mat[ch] mkv[imrc] nb[key] noautocmd o[pen] p[rint] perld[o] pro ptN[ext] ptp[revious] py3 pyf[ile] q[uit] redi[r] ret[ab] rub[y] sIc sIr sbN[ext] sbn[ext] scg scriptv[ersion] setl[ocal] sge sh[ell] sil[ent] sla[st] sn[ext] sp[lit] spellr[rare] src srp static sun[hide] sy tN[ext] tabe[dit] tabnew tc[d] ter[minal] tlmenu tma[p] tr[ewind] u[ndo] unlo[ckvar] vert[ical] vimgrepa[dd] wa[ll] wn[ext] x[it] xnoremenu y[ank]
-syn keyword vimCommand contained addd arge[dit] b[uffer] bl[ast] brea[k] buffers ca caf[ter] cbo[ttom] cex[pr] cgete[xpr] cl[ist] cn[ext] colo[rscheme] cons[t] cs d[elete] delc[ommand] deletp di[splay] diffs[plit] dl dr[op] ec el[se] endenum ene[w] export filt[er] fo[ld] fu[nction] h[elp] hi iabc[lear] import isp[lit] keepa l[ist] laf[ter] lbel[ow] lcscope lf[ile] lgr[ep] lli[st] lnf[ile] lol[der] lt[ag] lw[indow] menut[ranslate] mkvie[w] nbc[lose] noh[lsearch] ol[dfiles] pa[ckadd] po[p] prof[ile] pta[g] ptr[ewind] py3do python3 qa[ll] redr[aw] retu[rn] rubyd[o] sIe sN[ext] sb[uffer] sbp[revious] sci scs sf[ind] sgi si sim[alt] sm[agic] sno[magic] spe[llgood] spellu[ndo] sre[wind] st[op] stj[ump] sunme syn ta[g] tabf[ind] tabo[nly] tch[dir] tf[irst] tln tmapc[lear] try una[bbreviate] uns[ilent] vi[sual] viu[sage] wh[ile] wp[revious] xa[ll] xprop z[^.=]
-syn keyword vimCommand contained al[l] argg[lobal] ba[ll]
+syn keyword vimCommand contained a ar[gs] argl[ocal] bad[d] bn[ext] breakd[el] bw[ipeout] cabo[ve] cat[ch] ccl[ose] cfdo chd[ir] class cnf[ile] comc[lear] cp[revious] cstag debugg[reedy] delep dell diffg[et] dig[raphs] do dsp[lit] echoe[rr] em[enu] endfo[r] eval f[ile] fina[lly] foldd[oopen] gr[ep] helpc[lose] his[tory] ij[ump] inor j[oin] keepj[umps] lab[ove] lat lc[d] le[ft] lfir[st] lh[elpgrep] lmak[e] loadk lp[revious] luado ma[rk] mk[exrc] mz[scheme] new nore on[ly] pc[lose] pp[op] promptf[ind] ptj[ump] pu[t] py3f[ile] pyx r[ead] redrawt[abline] ri[ght] rundo sIl sal[l] sbf[irst] sc scp se[t] sg sgn sie sip sme snoremenu spelli[nfo] spr[evious] sri star[tinsert] sts[elect] sus[pend] syncbind tabN[ext] tabl[ast] tabr[ewind] tcld[o] tj[ump] tlu tno[remap] tu[nmenu] undol[ist] v vim9[cmd] vs[plit] win[size] wq xmapc[lear] xr[estore]
+syn keyword vimCommand contained ab arga[dd] argu[ment] balt bo[tright] breakl[ist] cN[ext] cad[dbuffer] cb[uffer] cd cfir[st] che[ckpath] cle[arjumps] cnor comp[iler] cpf[ile] cun def deletel delm[arks] diffo[ff] dir doau e[dit] echom[sg] en[dif] endinterface ex files fini[sh] folddoc[losed] grepa[dd] helpf[ind] hor[izontal] il[ist] interface ju[mps] keepp[atterns] lad[dexpr] later lch[dir] lefta[bove] lg[etfile] lhi[story] lmapc[lear] loadkeymap lpf[ile] luafile mak[e] mks[ession] mzf[ile] nmapc[lear] nos[wapfile] opt[ions] pe[rl] pre[serve] promptr[epl] ptl[ast] public py[thon] pyxdo rec[over] reg[isters] rightb[elow] rv[iminfo] sIn san[dbox] sbl[ast] scI scr[iptnames] setf[iletype] sgI sgp sig sir smenu so[urce] spellr[are] sr srl startg[replace] substitutepattern sv[iew] syntime tabc[lose] tabm[ove] tabs tclf[ile] tl[ast] tlunmenu to[pleft] tunma[p] unh[ide] ve[rsion] vim9s[cript] wN[ext] winc[md] wqa[ll] xme xunme
+syn keyword vimCommand contained abc[lear] argd[elete] as[cii] bd[elete] bp[revious] bro[wse] cNf[ile] cadde[xpr] cbe[fore] cdo cg[etfile] checkt[ime] clo[se] co[py] con[tinue] cq[uit] cuna[bbrev] defc[ompile] deletep delp diffp[atch] disa[ssemble] doaut ea echon endclass endt[ry] exi[t] filet fir[st] foldo[pen] gui helpg[rep] i imapc[lear] intro k lN[ext] laddb[uffer] lb[uffer] lcl[ose] leg[acy] lgetb[uffer] ll lne[xt] loc[kmarks] lr[ewind] lv[imgrep] marks mksp[ell] n[ext] noa nu[mber] ownsyntax ped[it] prev[ious] ps[earch] ptn[ext] pw[d] pydo pyxfile red[o] res[ize] ru[ntime] sI sIp sav[eas] sbm[odified] sce scripte[ncoding] setg[lobal] sgc sgr sign sl[eep] smile sor[t] spellr[epall] srI srn startr[eplace] substituterepeat sw[apname] t tabd[o] tabn[ext] tags te[aroff] tlm tm[enu] tp[revious] type unl verb[ose] vim[grep] w[rite] windo wundo xmenu xunmenu
+syn keyword vimCommand contained abo[veleft] argded[upe] au bel[owright] br[ewind] bufdo c[hange] caddf[ile] cbel[ow] ce[nter] cgetb[uffer] chi[story] cmapc[lear] col[der] conf[irm] cr[ewind] cw[indow] defer deletl dep diffpu[t] dj[ump] dp earlier echow[indow] enddef endw[hile] exp filetype fix[del] for gvim helpt[ags] ia imp is[earch] kee[pmarks] lNf[ile] laddf[ile] lbe[fore] lcs lex[pr] lgete[xpr] lla[st] lnew[er] lockv[ar] ls lvimgrepa[dd] mat[ch] mkv[imrc] nb[key] noautocmd o[pen] p[rint] perld[o] pro ptN[ext] ptp[revious] py3 pyf[ile] q[uit] redi[r] ret[ab] rub[y] sIc sIr sbN[ext] sbn[ext] scg scriptv[ersion] setl[ocal] sge sh[ell] sil[ent] sla[st] sn[ext] sp[lit] spellr[rare] src srp static sun[hide] sy tN[ext] tabe[dit] tabnew tc[d] ter[minal] tlmenu tma[p] tr[ewind] u[ndo] unlo[ckvar] vert[ical] vimgrepa[dd] wa[ll] winp[os] wv[iminfo] xnoreme xwininfo
+syn keyword vimCommand contained abstract argdo bN[ext] bf[irst] brea[k] buffers ca caf[ter] cbo[ttom] cex[pr] cgete[xpr] cl[ist] cn[ext] colo[rscheme] cons[t] cs d[elete] delc[ommand] deletp di[splay] diffs[plit] dl dr[op] ec el[se] endenum ene[w] export filt[er] fo[ld] fu[nction] h[elp] hi iabc[lear] import isp[lit] keepa l[ist] laf[ter] lbel[ow] lcscope lf[ile] lgr[ep] lli[st] lnf[ile] lol[der] lt[ag] lw[indow] menut[ranslate] mkvie[w] nbc[lose] noh[lsearch] ol[dfiles] pa[ckadd] po[p] prof[ile] pta[g] ptr[ewind] py3do python3 qa[ll] redr[aw] retu[rn] rubyd[o] sIe sN[ext] sb[uffer] sbp[revious] sci scs sf[ind] sgi si sim[alt] sm[agic] sno[magic] spe[llgood] spellu[ndo] sre[wind] st[op] stj[ump] sunme syn ta[g] tabf[ind] tabo[nly] tch[dir] tf[irst] tln tmapc[lear] try una[bbreviate] uns[ilent] vi[sual] viu[sage] wh[ile] wn[ext] x[it] xnoremenu y[ank]
+syn keyword vimCommand contained addd arge[dit] b[uffer] bl[ast] breaka[dd] bun[load] cabc[lear] cal[l] cc cf[ile] changes cla[st] cnew[er] com cope[n] cscope debug delel delf[unction] dif[fupdate] difft[his] dli[st] ds[earch] echoc[onsole] elsei[f] endf[unction] enum exu[sage] fin[d] foldc[lose] go[to] ha[rdcopy] hid[e] if in iuna[bbrev] keepalt la[st] lan[guage] lbo[ttom] ld[o] lfdo lgrepa[dd] lma lo[adview] lop[en] lua m[ove] mes[sages] mod[e] nbs[tart] nor omapc[lear] packl[oadall] popu[p] profd[el] ptf[irst] pts[elect] py3f[ile] pythonx quita[ll] redraws[tatus] rew[ind] rubyf[ile] sIg sa[rgument] sba[ll] sbr[ewind] scl scscope sfir[st] sgl sic sin sm[ap] snoreme spelld[ump] spellw[rong] srg sta[g] stopi[nsert] sunmenu sync tab tabfir[st] tabp[revious] tcl th[row] tlnoremenu tn[ext] ts[elect] undoj[oin] up[date] vie[w] vne[w] wi wp[revious] xa[ll] xprop z[^.=]
+syn keyword vimCommand contained al[l] argg[lobal] ba[ll] bm[odified]
syn match vimCommand contained "\<z[-+^.=]\=\>"
syn keyword vimStdPlugin contained Arguments Asm Break Cfilter Clear Continue DiffOrig Evaluate Finish Gdb Lfilter Man N[ext] Over P[rint] Program Run S Source Step Stop Termdebug TermdebugCommand TOhtml Until Winbar XMLent XMLns
@@ -79,12 +79,12 @@ syn match vimHLGroup contained "Conceal"
syn case match
" Function Names {{{2
-syn keyword vimFuncName contained abs argc assert_equal assert_match atan balloon_show bufexists bufwinid ceil ch_canread ch_getbufnr ch_read ch_status complete_check count deletebufline digraph_set eval exists_compiled extendnew findfile fnameescape foldtextresult get getchangelist getcmdcompltype getcompletion getfperm getline getpid getscriptinfo getwininfo glob2regpat histadd hlID indexof inputsecret isinf job_setoptions js_encode libcall list2str log10 mapnew matchdelete matchstrpos mzeval popup_atcursor popup_dialog popup_findpreview popup_locate popup_settext prompt_getprompt prop_add_list prop_type_add pum_getpos rand readfile reltimefloat remote_read repeat screenattr screenrow searchpair setbufline setcmdline setline setreg sha256 sign_getplaced sign_unplace slice sound_playfile sqrt str2nr strftime strpart submatch synconcealed system tagfiles term_dumpdiff term_getattr term_getsize term_list term_setkill test_alloc_fail test_getvalue test_null_channel test_null_partial test_setmouse timer_info tolower type values winbufnr win_getid win_id2win winnr win_splitmove
-syn keyword vimFuncName contained acos argidx assert_equalfile assert_nobeep atan2 balloon_split buflisted bufwinnr changenr ch_close ch_getjob ch_readblob cindent complete_info cscope_connection did_filetype digraph_setlist eventhandler exp feedkeys flatten fnamemodify foreground getbufinfo getchar getcmdline getcurpos getfsize getloclist getpos gettabinfo getwinpos globpath histdel hlset input insert islocked job_start json_decode libcallnr listener_add luaeval mapset matchend max nextnonblank popup_beval popup_filter_menu popup_getoptions popup_menu popup_show prompt_setcallback prop_clear prop_type_change pumvisible range reduce reltimestr remote_send resolve screenchar screenstring searchpairpos setbufvar setcmdpos setloclist settabvar shellescape sign_jump sign_unplacelist sort sound_stop srand strcharlen strgetchar strptime substitute synID systemlist taglist term_dumpload term_getcursor term_getstatus term_scrape term_setrestore test_autochdir test_gui_event test_null_dict test_null_string test_settime timer_pause toupper typename virtcol wincol win_gettype winlayout winrestcmd winwidth
-syn keyword vimFuncName contained add arglistid assert_exception assert_notequal autocmd_add blob2list bufload byte2line char2nr ch_close_in ch_info ch_readraw clearmatches confirm cursor diff_filler echoraw executable expand filereadable flattennew foldclosed fullcommand getbufline getcharmod getcmdpos getcursorcharpos getftime getmarklist getqflist gettabvar getwinposx has histget hostname inputdialog interrupt isnan job_status json_encode line listener_flush map match matchfuzzy menu_info nr2char popup_clear popup_filter_yesno popup_getpos popup_move pow prompt_setinterrupt prop_find prop_type_delete py3eval readblob reg_executing remote_expr remote_startserver reverse screenchars search searchpos setcellwidths setcursorcharpos setmatches settabwinvar shiftwidth sign_place simplify sound_clear spellbadword state strcharpart stridx strridx swapfilelist synIDattr tabpagebuflist tan term_dumpwrite term_getjob term_gettitle term_sendkeys term_setsize test_feedinput test_ignore_error test_null_function test_option_not_set test_srand_seed timer_start tr undofile virtcol2col windowsversion win_gotoid winline winrestview wordcount
-syn keyword vimFuncName contained and argv assert_fails assert_notmatch autocmd_delete browse bufloaded byteidx charclass chdir ch_log ch_sendexpr col copy debugbreak diff_hlID empty execute expandcmd filewritable float2nr foldclosedend funcref getbufoneline getcharpos getcmdscreenpos getcwd getftype getmatches getreg gettabwinvar getwinposy has_key histnr iconv inputlist invert items job_stop keys line2byte listener_remove maparg matchadd matchfuzzypos min or popup_close popup_findecho popup_hide popup_notification prevnonblank prompt_setprompt prop_list prop_type_get pyeval readdir reg_recording remote_foreground remove round screencol searchcount server2client setcharpos setenv setpos settagstack sign_define sign_placelist sin soundfold spellsuggest str2float strchars string strtrans swapinfo synIDtrans tabpagenr tanh term_getaltscreen term_getline term_gettty term_setansicolors term_start test_garbagecollect_now test_mswin_event test_null_job test_override test_unknown timer_stop trim undotree visualmode win_execute winheight win_move_separator winsaveview writefile
-syn keyword vimFuncName contained append asin assert_false assert_report autocmd_get browsedir bufname byteidxcomp charcol ch_evalexpr ch_logfile ch_sendraw complete cos deepcopy digraph_get environ exepath expr10 filter floor foldlevel function getbufvar getcharsearch getcmdtype getenv getimstatus getmousepos getreginfo gettagstack getwinvar haslocaldir hlexists indent inputrestore isabsolutepath job_getchannel join keytrans lispindent localtime mapcheck matchaddpos matchlist mkdir pathshorten popup_create popup_findinfo popup_list popup_setoptions printf prop_add prop_remove prop_type_list pyxeval readdirex reltime remote_peek rename rubyeval screenpos searchdecl serverlist setcharsearch setfperm setqflist setwinvar sign_getdefined sign_undefine sinh sound_playevent split str2list strdisplaywidth strlen strwidth swapname synstack tabpagewinnr tempname term_getansicolors term_getscrolled terminalprops term_setapi term_wait test_garbagecollect_soon test_null_blob test_null_list test_refcount test_void timer_stopall trunc uniq wildmenumode win_findbuf win_id2tabwin win_move_statusline win_screenpos xor
-syn keyword vimFuncName contained appendbufline assert_beeps assert_inrange assert_true balloon_gettext bufadd bufnr call charidx ch_evalraw ch_open ch_setoptions complete_add cosh delete digraph_getlist escape exists extend finddir fmod foldtext garbagecollect getcellwidths getcharstr getcmdwintype getfontname getjumplist getmouseshape getregtype gettext glob hasmapto hlget index inputsave isdirectory job_info js_decode len list2blob log maplist matcharg matchstr mode perleval
+syn keyword vimFuncName contained abs argc assert_equal assert_match atan balloon_show bufexists bufwinid ceil ch_canread ch_getbufnr ch_read ch_status complete_check count deletebufline digraph_set eval exists_compiled extendnew findfile fnameescape foldtextresult get getchangelist getcmdcompltype getcompletion getfperm getline getpid getscriptinfo getwininfo glob2regpat histadd hlID indexof inputsecret isinf job_setoptions js_encode libcall list2str log10 mapnew matchdelete matchstrpos mzeval popup_atcursor popup_filter_menu popup_getpos popup_move pow prompt_setinterrupt prop_find prop_type_delete py3eval readblob reg_executing remote_expr remote_startserver reverse screenchars search searchpos setcellwidths setcursorcharpos setmatches settabwinvar shiftwidth sign_place simplify sound_clear spellbadword state strcharpart stridx strridx substitute synID systemlist taglist term_dumpload term_getcursor term_getstatus term_scrape term_setrestore test_autochdir test_gui_event test_null_dict test_null_string test_settime timer_pause toupper typename values winbufnr win_getid win_id2win winnr win_splitmove
+syn keyword vimFuncName contained acos argidx assert_equalfile assert_nobeep atan2 balloon_split buflisted bufwinnr changenr ch_close ch_getjob ch_readblob cindent complete_info cscope_connection did_filetype digraph_setlist eventhandler exp feedkeys flatten fnamemodify foreground getbufinfo getchar getcmdline getcurpos getfsize getloclist getpos gettabinfo getwinpos globpath histdel hlset input insert islocked job_start json_decode libcallnr listener_add luaeval mapset matchend max nextnonblank popup_beval popup_filter_yesno popup_hide popup_notification prevnonblank prompt_setprompt prop_list prop_type_get pyeval readdir reg_recording remote_foreground remove round screencol searchcount server2client setcharpos setenv setpos settagstack sign_define sign_placelist sin soundfold spellsuggest str2float strchars string strtrans swapfilelist synIDattr tabpagebuflist tan term_dumpwrite term_getjob term_gettitle term_sendkeys term_setsize test_feedinput test_ignore_error test_null_function test_option_not_set test_srand_seed timer_start tr undofile virtcol wincol win_gettype winlayout winrestcmd winwidth
+syn keyword vimFuncName contained add arglistid assert_exception assert_notequal autocmd_add blob2list bufload byte2line char2nr ch_close_in ch_info ch_readraw clearmatches confirm cursor diff_filler echoraw executable expand filereadable flattennew foldclosed fullcommand getbufline getcharmod getcmdpos getcursorcharpos getftime getmarklist getqflist gettabvar getwinposx has histget hostname inputdialog interrupt isnan job_status json_encode line listener_flush map match matchfuzzy menu_info nr2char popup_clear popup_findecho popup_list popup_setoptions printf prop_add prop_remove prop_type_list pyxeval readdirex reltime remote_peek rename rubyeval screenpos searchdecl serverlist setcharsearch setfperm setqflist setwinvar sign_getdefined sign_undefine sinh sound_playevent split str2list strdisplaywidth strlen strutf16len swapinfo synIDtrans tabpagenr tanh term_getaltscreen term_getline term_gettty term_setansicolors term_start test_garbagecollect_now test_mswin_event test_null_job test_override test_unknown timer_stop trim undotree virtcol2col windowsversion win_gotoid winline winrestview wordcount
+syn keyword vimFuncName contained and argv assert_fails assert_notmatch autocmd_delete browse bufloaded byteidx charclass chdir ch_log ch_sendexpr col copy debugbreak diff_hlID empty execute expandcmd filewritable float2nr foldclosedend funcref getbufoneline getcharpos getcmdscreenpos getcwd getftype getmatches getreg gettabwinvar getwinposy has_key histnr iconv inputlist invert items job_stop keys line2byte listener_remove maparg matchadd matchfuzzypos min or popup_close popup_findinfo popup_locate popup_settext prompt_getprompt prop_add_list prop_type_add pum_getpos rand readfile reltimefloat remote_read repeat screenattr screenrow searchpair setbufline setcmdline setline setreg sha256 sign_getplaced sign_unplace slice sound_playfile sqrt str2nr strftime strpart strwidth swapname synstack tabpagewinnr tempname term_getansicolors term_getscrolled terminalprops term_setapi term_wait test_garbagecollect_soon test_null_blob test_null_list test_refcount test_void timer_stopall trunc uniq visualmode win_execute winheight win_move_separator winsaveview writefile
+syn keyword vimFuncName contained append asin assert_false assert_report autocmd_get browsedir bufname byteidxcomp charcol ch_evalexpr ch_logfile ch_sendraw complete cos deepcopy digraph_get environ exepath expr10 filter floor foldlevel function getbufvar getcharsearch getcmdtype getenv getimstatus getmousepos getreginfo gettagstack getwinvar haslocaldir hlexists indent inputrestore isabsolutepath job_getchannel join keytrans lispindent localtime mapcheck matchaddpos matchlist mkdir pathshorten popup_create popup_findpreview popup_menu popup_show prompt_setcallback prop_clear prop_type_change pumvisible range reduce reltimestr remote_send resolve screenchar screenstring searchpairpos setbufvar setcmdpos setloclist settabvar shellescape sign_jump sign_unplacelist sort sound_stop srand strcharlen strgetchar strptime submatch synconcealed system tagfiles term_dumpdiff term_getattr term_getsize term_list term_setkill test_alloc_fail test_getvalue test_null_channel test_null_partial test_setmouse timer_info tolower type utf16idx wildmenumode win_findbuf win_id2tabwin win_move_statusline win_screenpos xor
+syn keyword vimFuncName contained appendbufline assert_beeps assert_inrange assert_true balloon_gettext bufadd bufnr call charidx ch_evalraw ch_open ch_setoptions complete_add cosh delete digraph_getlist escape exists extend finddir fmod foldtext garbagecollect getcellwidths getcharstr getcmdwintype getfontname getjumplist getmouseshape getregtype gettext glob hasmapto hlget index inputsave isdirectory job_info js_decode len list2blob log maplist matcharg matchstr mode perleval popup_dialog popup_getoptions
"--- syntax here and above generated by mkvimvim ---
" Special Vim Highlighting (not automatic) {{{1
diff --git a/runtime/syntax/xpm.vim b/runtime/syntax/xpm.vim
index be9f38723e..efacdb9dc7 100644
--- a/runtime/syntax/xpm.vim
+++ b/runtime/syntax/xpm.vim
@@ -1,10 +1,12 @@
" Vim syntax file
" Language: X Pixmap
" Maintainer: Ronald Schild <rs@scutum.de>
-" Last Change: 2021 Oct 04
-" Version: 5.4n.1
+" Last Change: 2023 May 11
+" Version: 5.4n.2
" Jemma Nelson added termguicolors support
" Dominique Pellé fixed spelling support
+" Christian J. Robinson fixed use of global variables, moved
+" loop into a compiled function
" quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -21,108 +23,119 @@ syn region xpmPixelString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@xpmCo
if has("gui_running") || has("termguicolors") && &termguicolors
-let color = ""
-let chars = ""
-let colors = 0
-let cpp = 0
-let n = 0
-let i = 1
+def s:CreateSyntax(): void
+ var color = ""
+ var chars = ""
+ var colors = 0
+ var cpp = 0
+ var n = 0
+ var lines = getline(1, '$')
-while i <= line("$") " scanning all lines
+ for line in lines # scanning all lines
- let s = matchstr(getline(i), '".\{-1,}"')
- if s != "" " does line contain a string?
+ var s = matchstr(line, '".\{-1,}"')
- if n == 0 " first string is the Values string
+ if s != "" # does line contain a string?
- " get the 3rd value: colors = number of colors
- let colors = substitute(s, '"\s*\d\+\s\+\d\+\s\+\(\d\+\).*"', '\1', '')
- " get the 4th value: cpp = number of character per pixel
- let cpp = substitute(s, '"\s*\d\+\s\+\d\+\s\+\d\+\s\+\(\d\+\).*"', '\1', '')
- if cpp =~ '[^0-9]'
- break " if cpp is not made of digits there must be something wrong
- endif
+ if n == 0 # first string is the Values string
- " Highlight the Values string as normal string (no pixel string).
- " Only when there is no slash, it would terminate the pattern.
- if s !~ '/'
- exe 'syn match xpmValues /' . s . '/'
- endif
- hi link xpmValues String
+ var values = split(s[1 : -2])
+
+ # Values string invalid, bail out
+ if len(values) != 4
+ return
+ endif
- let n = 1 " n = color index
+ # get the 3rd value: colors = number of colors
+ colors = str2nr(values[2])
+ # get the 4th value: cpp = number of character per pixel
+ cpp = str2nr(values[3])
- elseif n <= colors " string is a color specification
+ # these values must be positive, nonzero
+ if colors < 1 || cpp < 1
+ return
+ endif
+
+ # Highlight the Values string as normal string (no pixel string).
+ # Only when there is no slash, it would terminate the pattern.
+ if s !~ '/'
+ exe 'syn match xpmValues /' .. s .. '/'
+ endif
+ hi link xpmValues String
- " get chars = <cpp> length string representing the pixels
- " (first incl. the following whitespace)
- let chars = substitute(s, '"\(.\{'.cpp.'}\s\).*"', '\1', '')
+ n = 1 # n = color index
- " now get color, first try 'c' key if any (color visual)
- let color = substitute(s, '".*\sc\s\+\(.\{-}\)\s*\(\(g4\=\|[ms]\)\s.*\)*\s*"', '\1', '')
- if color == s
- " no 'c' key, try 'g' key (grayscale with more than 4 levels)
- let color = substitute(s, '".*\sg\s\+\(.\{-}\)\s*\(\(g4\|[ms]\)\s.*\)*\s*"', '\1', '')
+ elseif n <= colors # string is a color specification
+
+ # get chars = <cpp> length string representing the pixels
+ # (first incl. the following whitespace)
+ chars = substitute(s, '"\(.\{' .. cpp .. '}\s\).*"', '\1', '')
+
+ # now get color, first try 'c' key if any (color visual)
+ color = substitute(s, '".*\sc\s\+\(.\{-}\)\s*\(\(g4\=\|[ms]\)\s.*\)*\s*"', '\1', '')
if color == s
- " next try: 'g4' key (4-level grayscale)
- let color = substitute(s, '".*\sg4\s\+\(.\{-}\)\s*\([ms]\s.*\)*\s*"', '\1', '')
+ # no 'c' key, try 'g' key (grayscale with more than 4 levels)
+ color = substitute(s, '".*\sg\s\+\(.\{-}\)\s*\(\(g4\|[ms]\)\s.*\)*\s*"', '\1', '')
if color == s
- " finally try 'm' key (mono visual)
- let color = substitute(s, '".*\sm\s\+\(.\{-}\)\s*\(s\s.*\)*\s*"', '\1', '')
+ # next try: 'g4' key (4-level grayscale)
+ color = substitute(s, '".*\sg4\s\+\(.\{-}\)\s*\([ms]\s.*\)*\s*"', '\1', '')
if color == s
- let color = ""
+ # finally try 'm' key (mono visual)
+ color = substitute(s, '".*\sm\s\+\(.\{-}\)\s*\(s\s.*\)*\s*"', '\1', '')
+ if color == s
+ color = ""
+ endif
endif
endif
endif
- endif
- " Vim cannot handle RGB codes with more than 6 hex digits
- if color =~ '#\x\{10,}$'
- let color = substitute(color, '\(\x\x\)\x\x', '\1', 'g')
- elseif color =~ '#\x\{7,}$'
- let color = substitute(color, '\(\x\x\)\x', '\1', 'g')
- " nor with 3 digits
- elseif color =~ '#\x\{3}$'
- let color = substitute(color, '\(\x\)\(\x\)\(\x\)', '0\10\20\3', '')
- endif
+ # Vim cannot handle RGB codes with more than 6 hex digits
+ if color =~ '#\x\{10,}$'
+ color = substitute(color, '\(\x\x\)\x\x', '\1', 'g')
+ elseif color =~ '#\x\{7,}$'
+ color = substitute(color, '\(\x\x\)\x', '\1', 'g')
+ # nor with 3 digits
+ elseif color =~ '#\x\{3}$'
+ color = substitute(color, '\(\x\)\(\x\)\(\x\)', '0\10\20\3', '')
+ endif
- " escape meta characters in patterns
- let s = escape(s, '/\*^$.~[]')
- let chars = escape(chars, '/\*^$.~[]')
-
- " now create syntax items
- " highlight the color string as normal string (no pixel string)
- exe 'syn match xpmCol'.n.'Def /'.s.'/ contains=xpmCol'.n.'inDef'
- exe 'hi link xpmCol'.n.'Def String'
-
- " but highlight the first whitespace after chars in its color
- exe 'syn match xpmCol'.n.'inDef /"'.chars.'/hs=s+'.(cpp+1).' contained'
- exe 'hi link xpmCol'.n.'inDef xpmColor'.n
-
- " remove the following whitespace from chars
- let chars = substitute(chars, '.$', '', '')
-
- " and create the syntax item contained in the pixel strings
- exe 'syn match xpmColor'.n.' /'.chars.'/ contained'
- exe 'syn cluster xpmColors add=xpmColor'.n
-
- " if no color or color = "None" show background
- if color == "" || substitute(color, '.*', '\L&', '') == 'none'
- exe 'hi xpmColor'.n.' guifg=bg'
- exe 'hi xpmColor'.n.' guibg=NONE'
- elseif color !~ "'"
- exe 'hi xpmColor'.n." guifg='".color."'"
- exe 'hi xpmColor'.n." guibg='".color."'"
+ # escape meta characters in patterns
+ s = escape(s, '/\*^$.~[] ')
+ chars = escape(chars, '/\*^$.~[] ')
+
+ # now create syntax items
+ # highlight the color string as normal string (no pixel string)
+ exe 'syn match xpmCol' .. n .. 'Def /' .. s .. '/ contains=xpmCol' .. n .. 'inDef'
+ exe 'hi link xpmCol' .. n .. 'Def String'
+
+ # but highlight the first whitespace after chars in its color
+ exe 'syn match xpmCol' .. n .. 'inDef /"' .. chars .. '/hs=s+' .. (cpp + 1) .. ' contained'
+ exe 'hi link xpmCol' .. n .. 'inDef xpmColor' .. n
+
+ # remove the following whitespace from chars
+ chars = substitute(chars, '.$', '', '')
+
+ # and create the syntax item contained in the pixel strings
+ exe 'syn match xpmColor' .. n .. ' /' .. chars .. '/ contained'
+ exe 'syn cluster xpmColors add=xpmColor' .. n
+
+ # if no color or color = "None" show background
+ if color == "" || substitute(color, '.*', '\L&', '') == 'none'
+ exe 'hi xpmColor' .. n .. ' guifg=bg'
+ exe 'hi xpmColor' .. n .. ' guibg=NONE'
+ elseif color !~ "'"
+ exe 'hi xpmColor' .. n .. " guifg='" .. color .. "'"
+ exe 'hi xpmColor' .. n .. " guibg='" .. color .. "'"
+ endif
+ n += 1
+ else
+ break # no more color string
endif
- let n = n + 1
- else
- break " no more color string
endif
- endif
- let i = i + 1
-endwhile
+ endfor
+enddef
-unlet color chars colors cpp n i s
+call s:CreateSyntax()
endif " has("gui_running") || has("termguicolors") && &termguicolors