To: vim_dev@googlegroups.com Subject: Patch 9.0.0453 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0453 Problem: On an AZERTY keyboard digit keys get the shift modifier. Solution: Remove the shift modifier from digit keys. (closes #11109) Files: src/misc2.c diff --git a/runtime/indent/lua.vim b/runtime/indent/lua.vim index 604cd333c93e..0d1f934a03ab 100644 --- a/runtime/indent/lua.vim +++ b/runtime/indent/lua.vim @@ -3,6 +3,7 @@ " Maintainer: Marcus Aurelius Farias " First Author: Max Ischenko " Last Change: 2017 Jun 13 +" 2022 Sep 07: b:undo_indent added by Doug Kearns " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -18,6 +19,8 @@ setlocal indentkeys+=0=end,0=until setlocal autoindent +let b:undo_indent = "setlocal autoindent< indentexpr< indentkeys<" + " Only define the function once. if exists("*GetLuaIndent") finish diff --git a/runtime/syntax/lua.vim b/runtime/syntax/lua.vim index 437a1ff11338..9c5a49058264 100644 --- a/runtime/syntax/lua.vim +++ b/runtime/syntax/lua.vim @@ -1,11 +1,12 @@ " Vim syntax file -" Language: Lua 4.0, Lua 5.0, Lua 5.1 and Lua 5.2 +" Language: Lua 4.0, Lua 5.0, Lua 5.1, Lua 5.2 and Lua 5.3 " Maintainer: Marcus Aurelius Farias " First Author: Carlos Augusto Teixeira Mendes -" Last Change: 2022 Mar 31 +" Last Change: 2022 Sep 07 " Options: lua_version = 4 or 5 -" lua_subversion = 0 (4.0, 5.0) or 1 (5.1) or 2 (5.2) -" default 5.2 +" lua_subversion = 0 (for 4.0 or 5.0) +" or 1, 2, 3 (for 5.1, 5.2 or 5.3) +" the default is 5.3 " quit when a syntax file was already loaded if exists("b:current_syntax") @@ -16,70 +17,78 @@ let s:cpo_save = &cpo set cpo&vim if !exists("lua_version") - " Default is lua 5.2 + " Default is lua 5.3 let lua_version = 5 - let lua_subversion = 2 + let lua_subversion = 3 elseif !exists("lua_subversion") - " lua_version exists, but lua_subversion doesn't. So, set it to 0 + " lua_version exists, but lua_subversion doesn't. In this case set it to 0 let lua_subversion = 0 endif syn case match " syncing method -syn sync minlines=100 +syn sync minlines=1000 -" Comments -syn keyword luaTodo contained TODO FIXME XXX -syn match luaComment "--.*$" contains=luaTodo,@Spell -if lua_version == 5 && lua_subversion == 0 - syn region luaComment matchgroup=luaCommentDelimiter start="--\[\[" end="\]\]" contains=luaTodo,luaInnerComment,@Spell - syn region luaInnerComment contained transparent start="\[\[" end="\]\]" -elseif lua_version > 5 || (lua_version == 5 && lua_subversion >= 1) - " Comments in Lua 5.1: --[[ ... ]], [=[ ... ]=], [===[ ... ]===], etc. - syn region luaComment matchgroup=luaCommentDelimiter start="--\[\z(=*\)\[" end="\]\z1\]" contains=luaTodo,@Spell +if lua_version >= 5 + syn keyword luaMetaMethod __add __sub __mul __div __pow __unm __concat + syn keyword luaMetaMethod __eq __lt __le + syn keyword luaMetaMethod __index __newindex __call + syn keyword luaMetaMethod __metatable __mode __gc __tostring endif -" First line may start with #! -syn match luaComment "\%^#!.*" +if lua_version > 5 || (lua_version == 5 && lua_subversion >= 1) + syn keyword luaMetaMethod __mod __len +endif + +if lua_version > 5 || (lua_version == 5 && lua_subversion >= 2) + syn keyword luaMetaMethod __pairs +endif + +if lua_version > 5 || (lua_version == 5 && lua_subversion >= 3) + syn keyword luaMetaMethod __idiv __name + syn keyword luaMetaMethod __band __bor __bxor __bnot __shl __shr +endif + +if lua_version > 5 || (lua_version == 5 && lua_subversion >= 4) + syn keyword luaMetaMethod __close +endif " catch errors caused by wrong parenthesis and wrong curly brackets or " keywords placed outside their respective blocks -syn region luaParen transparent start='(' end=')' contains=ALLBUT,luaParenError,luaTodo,luaSpecial,luaIfThen,luaElseifThen,luaElse,luaThenEnd,luaBlock,luaLoopBlock,luaIn,luaStatement -syn region luaTableBlock transparent matchgroup=luaTable start="{" end="}" contains=ALLBUT,luaBraceError,luaTodo,luaSpecial,luaIfThen,luaElseifThen,luaElse,luaThenEnd,luaBlock,luaLoopBlock,luaIn,luaStatement +syn region luaParen transparent start='(' end=')' contains=TOP,luaParenError syn match luaParenError ")" -syn match luaBraceError "}" +syn match luaError "}" syn match luaError "\<\%(end\|else\|elseif\|then\|until\|in\)\>" -" function ... end -syn region luaFunctionBlock transparent matchgroup=luaFunction start="\" end="\" contains=ALLBUT,luaTodo,luaSpecial,luaElseifThen,luaElse,luaThenEnd,luaIn +" Function declaration +syn region luaFunctionBlock transparent matchgroup=luaFunction start="\" end="\" contains=TOP -" if ... then -syn region luaIfThen transparent matchgroup=luaCond start="\" end="\"me=e-4 contains=ALLBUT,luaTodo,luaSpecial,luaElseifThen,luaElse,luaIn nextgroup=luaThenEnd skipwhite skipempty +" else +syn keyword luaCondElse matchgroup=luaCond contained containedin=luaCondEnd else " then ... end -syn region luaThenEnd contained transparent matchgroup=luaCond start="\" end="\" contains=ALLBUT,luaTodo,luaSpecial,luaThenEnd,luaIn +syn region luaCondEnd contained transparent matchgroup=luaCond start="\" end="\" contains=TOP " elseif ... then -syn region luaElseifThen contained transparent matchgroup=luaCond start="\" end="\" contains=ALLBUT,luaTodo,luaSpecial,luaElseifThen,luaElse,luaThenEnd,luaIn +syn region luaCondElseif contained containedin=luaCondEnd transparent matchgroup=luaCond start="\" end="\" contains=TOP -" else -syn keyword luaElse contained else +" if ... then +syn region luaCondStart transparent matchgroup=luaCond start="\" end="\"me=e-4 contains=TOP nextgroup=luaCondEnd skipwhite skipempty " do ... end -syn region luaBlock transparent matchgroup=luaStatement start="\" end="\" contains=ALLBUT,luaTodo,luaSpecial,luaElseifThen,luaElse,luaThenEnd,luaIn - +syn region luaBlock transparent matchgroup=luaStatement start="\" end="\" contains=TOP " repeat ... until -syn region luaLoopBlock transparent matchgroup=luaRepeat start="\" end="\" contains=ALLBUT,luaTodo,luaSpecial,luaElseifThen,luaElse,luaThenEnd,luaIn +syn region luaRepeatBlock transparent matchgroup=luaRepeat start="\" end="\" contains=TOP " while ... do -syn region luaLoopBlock transparent matchgroup=luaRepeat start="\" end="\"me=e-2 contains=ALLBUT,luaTodo,luaSpecial,luaIfThen,luaElseifThen,luaElse,luaThenEnd,luaIn nextgroup=luaBlock skipwhite skipempty +syn region luaWhile transparent matchgroup=luaRepeat start="\" end="\"me=e-2 contains=TOP nextgroup=luaBlock skipwhite skipempty " for ... do and for ... in ... do -syn region luaLoopBlock transparent matchgroup=luaRepeat start="\" end="\"me=e-2 contains=ALLBUT,luaTodo,luaSpecial,luaIfThen,luaElseifThen,luaElse,luaThenEnd nextgroup=luaBlock skipwhite skipempty +syn region luaFor transparent matchgroup=luaRepeat start="\" end="\"me=e-2 contains=TOP nextgroup=luaBlock skipwhite skipempty -syn keyword luaIn contained in +syn keyword luaFor contained containedin=luaFor in " other keywords syn keyword luaStatement return local break @@ -87,24 +96,48 @@ if lua_version > 5 || (lua_version == 5 && lua_subversion >= 2) syn keyword luaStatement goto syn match luaLabel "::\I\i*::" endif + +" operators syn keyword luaOperator and or not + +if (lua_version == 5 && lua_subversion >= 3) || lua_version > 5 + syn match luaSymbolOperator "[#<>=~^&|*/%+-]\|\.\{2,3}" +elseif lua_version == 5 && (lua_subversion == 1 || lua_subversion == 2) + syn match luaSymbolOperator "[#<>=~^*/%+-]\|\.\{2,3}" +else + syn match luaSymbolOperator "[<>=~^*/+-]\|\.\{2,3}" +endif + +" comments +syn keyword luaTodo contained TODO FIXME XXX +syn match luaComment "--.*$" contains=luaTodo,@Spell +if lua_version == 5 && lua_subversion == 0 + syn region luaComment matchgroup=luaCommentDelimiter start="--\[\[" end="\]\]" contains=luaTodo,luaInnerComment,@Spell + syn region luaInnerComment contained transparent start="\[\[" end="\]\]" +elseif lua_version > 5 || (lua_version == 5 && lua_subversion >= 1) + " Comments in Lua 5.1: --[[ ... ]], [=[ ... ]=], [===[ ... ]===], etc. + syn region luaComment matchgroup=luaCommentDelimiter start="--\[\z(=*\)\[" end="\]\z1\]" contains=luaTodo,@Spell +endif + +" first line may start with #! +syn match luaComment "\%^#!.*" + syn keyword luaConstant nil if lua_version > 4 syn keyword luaConstant true false endif -" Strings -if lua_version < 5 - syn match luaSpecial contained "\\[\\abfnrtv\'\"]\|\\[[:digit:]]\{,3}" -elseif lua_version == 5 +" strings +syn match luaSpecial contained #\\[\\abfnrtv'"[\]]\|\\[[:digit:]]\{,3}# +if lua_version == 5 if lua_subversion == 0 - syn match luaSpecial contained #\\[\\abfnrtv'"[\]]\|\\[[:digit:]]\{,3}# syn region luaString2 matchgroup=luaStringDelimiter start=+\[\[+ end=+\]\]+ contains=luaString2,@Spell else - if lua_subversion == 1 - syn match luaSpecial contained #\\[\\abfnrtv'"]\|\\[[:digit:]]\{,3}# - else " Lua 5.2 - syn match luaSpecial contained #\\[\\abfnrtvz'"]\|\\x[[:xdigit:]]\{2}\|\\[[:digit:]]\{,3}# + if lua_subversion >= 2 + syn match luaSpecial contained #\\z\|\\x[[:xdigit:]]\{2}# + endif + if lua_subversion >= 3 + syn match luaSpecial contained #\\u{[[:xdigit:]]\+}# endif syn region luaString2 matchgroup=luaStringDelimiter start="\[\z(=*\)\[" end="\]\z1\]" contains=@Spell endif @@ -115,7 +148,7 @@ syn region luaString matchgroup=luaStringDelimiter start=+"+ end=+"+ skip=+\\\\\ " integer number syn match luaNumber "\<\d\+\>" " floating point number, with dot, optional exponent -syn match luaNumber "\<\d\+\.\d*\%([eE][-+]\=\d\+\)\=\>" +syn match luaNumber "\<\d\+\.\d*\%([eE][-+]\=\d\+\)\=" " floating point number, starting with a dot, optional exponent syn match luaNumber "\.\d\+\%([eE][-+]\=\d\+\)\=\>" " floating point number, without dot, with exponent @@ -130,8 +163,15 @@ if lua_version >= 5 endif endif +" tables +syn region luaTableBlock transparent matchgroup=luaTable start="{" end="}" contains=TOP,luaStatement + +" methods +syntax match luaFunc ":\@<=\k\+" + +" built-in functions syn keyword luaFunc assert collectgarbage dofile error next -syn keyword luaFunc print rawget rawset tonumber tostring type _VERSION +syn keyword luaFunc print rawget rawset self tonumber tostring type _VERSION if lua_version == 4 syn keyword luaFunc _ALERT _ERRORMESSAGE gcinfo @@ -168,30 +208,26 @@ elseif lua_version == 5 syn match luaFunc /\/ syn match luaFunc /\/ syn match luaFunc /\/ + syn match luaFunc /\/ if lua_subversion == 1 syn keyword luaFunc getfenv setfenv syn keyword luaFunc loadstring module unpack syn match luaFunc /\/ - syn match luaFunc /\/ syn match luaFunc /\/ - elseif lua_subversion == 2 + elseif lua_subversion >= 2 syn keyword luaFunc _ENV rawlen syn match luaFunc /\/ syn match luaFunc /\/ syn match luaFunc /\/ syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ + endif + + if lua_subversion >= 3 + syn match luaFunc /\/ + endif + if lua_subversion >= 4 + syn keyword luaFunc warn + syn match luaFunc /\/ endif syn match luaFunc /\/ endif @@ -200,6 +236,7 @@ elseif lua_version == 5 syn match luaFunc /\/ syn match luaFunc /\/ syn match luaFunc /\/ + syn match luaFunc /\/ syn match luaFunc /\/ syn match luaFunc /\/ @@ -218,6 +255,18 @@ elseif lua_version == 5 syn match luaFunc /\/ syn match luaFunc /\/ endif + if lua_subversion >= 3 + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + endif + if lua_subversion == 0 syn match luaFunc /\/ syn match luaFunc /\/ @@ -225,19 +274,40 @@ elseif lua_version == 5 syn match luaFunc /\/ elseif lua_subversion == 1 syn match luaFunc /\/ - elseif lua_subversion == 2 + elseif lua_subversion >= 2 syn match luaFunc /\/ syn match luaFunc /\/ + if lua_subversion >= 3 + syn match luaFunc /\/ + endif endif syn match luaFunc /\/ - syn match luaFunc /\/ syn match luaFunc /\/ + syn match luaFunc /\/ syn match luaFunc /\/ + + if lua_subversion == 2 + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + endif + syn match luaFunc /\/ syn match luaFunc /\/ syn match luaFunc /\/ syn match luaFunc /\/ - syn match luaFunc /\/ + if lua_subversion < 3 + syn match luaFunc /\/ + endif syn match luaFunc /\/ syn match luaFunc /\/ syn match luaFunc /\/ @@ -251,25 +321,36 @@ elseif lua_version == 5 if lua_subversion == 0 syn match luaFunc /\/ syn match luaFunc /\/ - else - if lua_subversion == 1 - syn match luaFunc /\/ - endif + elseif lua_subversion == 1 + syn match luaFunc /\/ + endif + if lua_subversion >= 1 syn match luaFunc /\/ syn match luaFunc /\/ syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ + if lua_subversion == 1 || lua_subversion == 2 + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + endif endif - syn match luaFunc /\/ syn match luaFunc /\/ syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ + if lua_subversion < 3 + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + else + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + endif syn match luaFunc /\/ syn match luaFunc /\/ syn match luaFunc /\/ + syn match luaFunc /\/ syn match luaFunc /\/ syn match luaFunc /\/ @@ -284,6 +365,7 @@ elseif lua_version == 5 syn match luaFunc /\/ syn match luaFunc /\/ syn match luaFunc /\/ + syn match luaFunc /\/ syn match luaFunc /\/ syn match luaFunc /\/ @@ -295,6 +377,7 @@ elseif lua_version == 5 syn match luaFunc /\/ syn match luaFunc /\/ syn match luaFunc /\/ + syn match luaFunc /\/ syn match luaFunc /\/ syn match luaFunc /\/ @@ -307,26 +390,20 @@ elseif lua_version == 5 if lua_subversion == 1 syn match luaFunc /\/ syn match luaFunc /\/ + endif + if lua_subversion >= 1 syn match luaFunc /\/ syn match luaFunc /\/ syn match luaFunc /\/ - elseif lua_subversion == 2 - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - endif - if lua_subversion >= 3 - "https://www.lua.org/manual/5.3/manual.html#6.5 - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ - syn match luaFunc /\/ + if lua_subversion >= 2 + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + syn match luaFunc /\/ + endif + if lua_subversion >= 4 + syn match luaFunc /\/ + endif endif endif @@ -341,18 +418,18 @@ hi def link luaString2 String hi def link luaStringDelimiter luaString hi def link luaNumber Number hi def link luaOperator Operator -hi def link luaIn Operator +hi def link luaSymbolOperator luaOperator hi def link luaConstant Constant hi def link luaCond Conditional -hi def link luaElse Conditional +hi def link luaCondElse Conditional hi def link luaFunction Function +hi def link luaMetaMethod Function hi def link luaComment Comment hi def link luaCommentDelimiter luaComment hi def link luaTodo Todo hi def link luaTable Structure hi def link luaError Error hi def link luaParenError Error -hi def link luaBraceError Error hi def link luaSpecial SpecialChar hi def link luaFunc Identifier hi def link luaLabel Label -- hundred-and-one symptoms of being an internet addict: 52. You ask a plumber how much it would cost to replace the chair in front of your computer with a toilet. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///