From: Sergio Alejandro Vargas Date: Tue, 9 Dec 2025 11:55:17 +0000 (+0100) Subject: runtime(julia): Update Julia runtime files X-Git-Tag: v9.1.1963~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f958d357237970728e448a23df4cf831f97a9ae9;p=thirdparty%2Fvim.git runtime(julia): Update Julia runtime files Port changes from JuliaEditorSupport/julia-vim made during 2022-2025. Most notably: - 88f178c Do not reset shiftwidth/expandtab at undo - f17257a Allow else block in try/catch - 7946ce3 Support public statements (added in Julia v1.11.0-DEV.469) Signed-off-by: Sergio Alejandro Vargas Signed-off-by: Christian Brabandt --- diff --git a/runtime/ftplugin/julia.vim b/runtime/ftplugin/julia.vim index b65cf99711..e2e7342822 100644 --- a/runtime/ftplugin/julia.vim +++ b/runtime/ftplugin/julia.vim @@ -3,7 +3,7 @@ " Maintainer: Carlo Baldassi " Homepage: https://github.com/JuliaEditorSupport/julia-vim " Last Change: 2021 Aug 04 -" adapted from upstream 2021 Aug 4 +" 2025 Dec 9 sync with upstream repo #18894 if exists("b:did_ftplugin") finish @@ -11,12 +11,12 @@ endif let b:did_ftplugin = 1 let s:save_cpo = &cpo -set cpo-=C +set cpo&vim setlocal include=^\\s*\\%(reload\\\|include\\)\\> setlocal suffixesadd=.jl setlocal comments=:# -setlocal commentstring=#\ %s +setlocal commentstring=#=%s=# setlocal cinoptions+=#1 setlocal define=^\\s*macro\\> setlocal fo-=t fo+=croql @@ -24,7 +24,7 @@ setlocal fo-=t fo+=croql let b:julia_vim_loaded = 1 let b:undo_ftplugin = "setlocal include< suffixesadd< comments< commentstring<" - \ . " define< fo< shiftwidth< expandtab< indentexpr< indentkeys< cinoptions< completefunc<" + \ . " define< fo< cinoptions< completefunc<" \ . " | unlet! b:julia_vim_loaded" " MatchIt plugin support @@ -68,7 +68,7 @@ if exists("loaded_matchit") elseif attr == 'juliaBlKeyword' return b:julia_begin_keywordsm . ':' . b:julia_end_keywords elseif attr == 'juliaException' - return b:julia_begin_keywordsm . ':\<\%(catch\|finally\)\>:' . b:julia_end_keywords + return b:julia_begin_keywordsm . ':\<\%(catch\|else\|finally\)\>:' . b:julia_end_keywords endif return '\<\>:\<\>' endfunction diff --git a/runtime/indent/julia.vim b/runtime/indent/julia.vim index efc98a2851..d01aa965df 100644 --- a/runtime/indent/julia.vim +++ b/runtime/indent/julia.vim @@ -4,6 +4,7 @@ " Homepage: https://github.com/JuliaEditorSupport/julia-vim " Last Change: 2022 Jun 14 " 2023 Aug 28 by Vim Project (undo_indent) +" 2025 Dec 08 by Vim Project (update indent script from upstream #18894) " Notes: originally based on Bram Moolenaar's indent file for vim " Only load this indent file when no other was loaded. @@ -22,7 +23,7 @@ setlocal indentkeys-=0{ setlocal indentkeys-=0} setlocal nosmartindent -let b:undo_indent = "setl ai< inde< indk< si<" +let b:undo_indent = "setlocal autoindent< indentexpr< indentkeys< smartindent<" " Only define the function once. if exists("*GetJuliaIndent") @@ -96,7 +97,7 @@ function GetJuliaNestingStruct(lnum, ...) let i = JuliaMatch(a:lnum, line, '\', s) if i >= 0 && i == fb let s = i+1 - if len(blocks_stack) > 0 && blocks_stack[-1] =~# '\<\%(else\)\=if\>' + if len(blocks_stack) > 0 && blocks_stack[-1] =~# '\<\%(\%(else\)\=if\|catch\)\>' let blocks_stack[-1] = 'else' else call add(blocks_stack, 'else') @@ -114,7 +115,7 @@ function GetJuliaNestingStruct(lnum, ...) let i = JuliaMatch(a:lnum, line, '\', s) if i >= 0 && i == fb let s = i+1 - if len(blocks_stack) > 0 && blocks_stack[-1] == 'try' + if len(blocks_stack) > 0 && blocks_stack[-1] =~# '\<\%(try\|finally\)\>' let blocks_stack[-1] = 'catch' else call add(blocks_stack, 'catch') @@ -125,7 +126,7 @@ function GetJuliaNestingStruct(lnum, ...) let i = JuliaMatch(a:lnum, line, '\', s) if i >= 0 && i == fb let s = i+1 - if len(blocks_stack) > 0 && (blocks_stack[-1] == 'try' || blocks_stack[-1] == 'catch') + if len(blocks_stack) > 0 && blocks_stack[-1] =~# '\<\%(try\|catch\|else\)\>' let blocks_stack[-1] = 'finally' else call add(blocks_stack, 'finally') @@ -298,7 +299,7 @@ function IsInContinuationImportLine(lnum) if len(stack) == 0 return 0 endif - return JuliaMatch(a:lnum, getline(a:lnum), '\<\%(import\|using\|export\)\>', indent(a:lnum)) == -1 + return JuliaMatch(a:lnum, getline(a:lnum), '\<\%(import\|using\|export\|public\)\>', indent(a:lnum)) == -1 endfunction function IsFunctionArgPar(lnum, c) @@ -314,7 +315,7 @@ function JumpToMatch(lnum, last_closed_bracket) " otherwise resorts to vim's default, which is buggy but better than " nothing) call cursor(a:lnum, a:last_closed_bracket) - let percmap = maparg("%", "n") + let percmap = maparg("%", "n") if exists("g:loaded_matchit") && percmap =~# 'Match\%(it\|_wrapper\)' normal % else @@ -448,10 +449,10 @@ function GetJuliaIndent() " Decrease indentation for each closed block in the current line let ind -= shiftwidth() * num_closed_blocks - " Additional special case: multiline import/using/export statements + " Additional special case: multiline import/using/export/public statements let prevline = getline(lnum) - " Are we in a multiline import/using/export statement, right below the + " Are we in a multiline import/using/export/public statement, right below the " opening line? if IsInContinuationImportLine(v:lnum) && !IsInContinuationImportLine(lnum) if get(g:, 'julia_indent_align_import', 1) @@ -465,9 +466,9 @@ function GetJuliaIndent() return cind + 2 endif else - " if the opening line is not a naked import/using/export statement, use + " if the opening line is not a naked import/using/export/public statement, use " it as reference - let iind = JuliaMatch(lnum, prevline, '\', indent(lnum), lim) + let iind = JuliaMatch(lnum, prevline, '\', indent(lnum), lim) if iind >= 0 " assuming whitespace after using... so no `using(XYZ)` please! let nonwhiteind = JuliaMatch(lnum, prevline, '\S', iind+6, -1, 'basic') @@ -479,7 +480,7 @@ function GetJuliaIndent() endif let ind += shiftwidth() - " Or did we just close a multiline import/using/export statement? + " Or did we just close a multiline import/using/export/public statement? elseif !IsInContinuationImportLine(v:lnum) && IsInContinuationImportLine(lnum) " find the starting line of the statement let ilnum = 0 diff --git a/runtime/syntax/julia.vim b/runtime/syntax/julia.vim index ec7eabf109..99a0a1a8c8 100644 --- a/runtime/syntax/julia.vim +++ b/runtime/syntax/julia.vim @@ -3,6 +3,7 @@ " Maintainer: Carlo Baldassi " Homepage: https://github.com/JuliaEditorSupport/julia-vim " Last Change: 2021 Aug 04 +" 2025 Dec 08 by Vim Project (update syntax script from upstream #18894) if version < 600 syntax clear @@ -41,8 +42,8 @@ let s:julia_highlight_operators = get(g:, "julia_highlight_operators", 1) " because those may or may not be valid in the lookbehind on a case-by-case " basis. let s:nonid_chars = '\U00-\U08' . '\U0A-\U1F' - \ . '\U21-\U28' . '\U2A-\U2F' . '\U3A-\U40' . '\U5B-\U5E' . '\U60' . '\U7B\U7C' - \ . '\U7E-\UA1' . '\UA7\UA8' . '\UAB-\UAD' . '\UAF\UB1\UB4' . '\UB6-\UB8' . '\UBB\UBF' . '\UD7\UF7' + \ . '\U21-\U28' . '\U2A-\U2F' . '\U3A-\U40' . '\U5B\U5C\U5E' . '\U60' . '\U7B\U7C' + \ . '\U7E-\UA1' . '\UA7\UA8' . '\UAB-\UAD' . '\UAF\UB1\UB4' . '\UB6-\UB8' . '\UBB\UBF' . '\UD7\UF7' " The complete list let s:nonidS_chars = '[:space:])\U5D}' . s:nonid_chars @@ -59,12 +60,6 @@ let s:op_chars = '\U25\U26\U2A\U2B\U2D\U2F\U3C-\U3E\U5C\U5E\U7C\U7E\UAC\UB1\UD7\ " The list contains the following characters: '…⁝⅋←↑→↓↔↚↛↜↝↞↠↢↣↤↦↩↪↫↬↮↶↷↺↻↼↽⇀⇁⇄⇆⇇⇉⇋⇌⇍⇎⇏⇐⇒⇔⇚⇛⇜⇝⇠⇢⇴⇵⇶⇷⇸⇹⇺⇻⇼⇽⇾⇿∈∉∊∋∌∍∓∔∗∘∙√∛∜∝∤∥∦∧∨∩∪∷∸∺∻∽∾≀≁≂≃≄≅≆≇≈≉≊≋≌≍≎≏≐≑≒≓≔≕≖≗≘≙≚≛≜≝≞≟≠≡≢≣≤≥≦≧≨≩≪≫≬≭≮≯≰≱≲≳≴≵≶≷≸≹≺≻≼≽≾≿⊀⊁⊂⊃⊄⊅⊆⊇⊈⊉⊊⊋⊍⊎⊏⊐⊑⊒⊓⊔⊕⊖⊗⊘⊙⊚⊛⊜⊞⊟⊠⊡⊢⊣⊩⊬⊮⊰⊱⊲⊳⊴⊵⊶⊷⊻⊼⊽⋄⋅⋆⋇⋉⋊⋋⋌⋍⋎⋏⋐⋑⋒⋓⋕⋖⋗⋘⋙⋚⋛⋜⋝⋞⋟⋠⋡⋢⋣⋤⋥⋦⋧⋨⋩⋪⋫⋬⋭⋮⋯⋰⋱⋲⋳⋴⋵⋶⋷⋸⋹⋺⋻⋼⋽⋾⋿⌿▷⟂⟈⟉⟑⟒⟕⟖⟗⟰⟱⟵⟶⟷⟹⟺⟻⟼⟽⟾⟿⤀⤁⤂⤃⤄⤅⤆⤇⤈⤉⤊⤋⤌⤍⤎⤏⤐⤑⤒⤓⤔⤕⤖⤗⤘⤝⤞⤟⤠⥄⥅⥆⥇⥈⥉⥊⥋⥌⥍⥎⥏⥐⥑⥒⥓⥔⥕⥖⥗⥘⥙⥚⥛⥜⥝⥞⥟⥠⥡⥢⥣⥤⥥⥦⥧⥨⥩⥪⥫⥬⥭⥮⥯⥰⦷⦸⦼⦾⦿⧀⧁⧡⧣⧤⧥⧴⧶⧷⧺⧻⨇⨈⨝⨟⨢⨣⨤⨥⨦⨧⨨⨩⨪⨫⨬⨭⨮⨰⨱⨲⨳⨴⨵⨶⨷⨸⨹⨺⨻⨼⨽⩀⩁⩂⩃⩄⩅⩊⩋⩌⩍⩎⩏⩐⩑⩒⩓⩔⩕⩖⩗⩘⩚⩛⩜⩝⩞⩟⩠⩡⩢⩣⩦⩧⩪⩫⩬⩭⩮⩯⩰⩱⩲⩳⩴⩵⩶⩷⩸⩹⩺⩻⩼⩽⩾⩿⪀⪁⪂⪃⪄⪅⪆⪇⪈⪉⪊⪋⪌⪍⪎⪏⪐⪑⪒⪓⪔⪕⪖⪗⪘⪙⪚⪛⪜⪝⪞⪟⪠⪡⪢⪣⪤⪥⪦⪧⪨⪩⪪⪫⪬⪭⪮⪯⪰⪱⪲⪳⪴⪵⪶⪷⪸⪹⪺⪻⪼⪽⪾⪿⫀⫁⫂⫃⫄⫅⫆⫇⫈⫉⫊⫋⫌⫍⫎⫏⫐⫑⫒⫓⫔⫕⫖⫗⫘⫙⫛⫷⫸⫹⫺⬰⬱⬲⬳⬴⬵⬶⬷⬸⬹⬺⬻⬼⬽⬾⬿⭀⭁⭂⭃⭄⭇⭈⭉⭊⭋⭌←↑→↓' let s:op_chars_wc = '\U2026\U205D\U214B\U2190-\U2194\U219A-\U219E\U21A0\U21A2-\U21A4\U21A6\U21A9-\U21AC\U21AE\U21B6\U21B7\U21BA-\U21BD\U21C0\U21C1\U21C4\U21C6\U21C7\U21C9\U21CB-\U21D0\U21D2\U21D4\U21DA-\U21DD\U21E0\U21E2\U21F4-\U21FF\U2208-\U220D\U2213\U2214\U2217-\U221D\U2224-\U222A\U2237\U2238\U223A\U223B\U223D\U223E\U2240-\U228B\U228D-\U229C\U229E-\U22A3\U22A9\U22AC\U22AE\U22B0-\U22B7\U22BB-\U22BD\U22C4-\U22C7\U22C9-\U22D3\U22D5-\U22FF\U233F\U25B7\U27C2\U27C8\U27C9\U27D1\U27D2\U27D5-\U27D7\U27F0\U27F1\U27F5-\U27F7\U27F9-\U27FF\U2900-\U2918\U291D-\U2920\U2944-\U2970\U29B7\U29B8\U29BC\U29BE-\U29C1\U29E1\U29E3-\U29E5\U29F4\U29F6\U29F7\U29FA\U29FB\U2A07\U2A08\U2A1D\U2A1F\U2A22-\U2A2E\U2A30-\U2A3D\U2A40-\U2A45\U2A4A-\U2A58\U2A5A-\U2A63\U2A66\U2A67\U2A6A-\U2AD9\U2ADB\U2AF7-\U2AFA\U2B30-\U2B44\U2B47-\U2B4C\UFFE9-\UFFEC' -" Full operators regex -let s:operators = '\%(' . '\.\%([-+*/^÷%|&⊻]\|//\|\\\|>>\|>>>\?\)\?=' . - \ '\|' . '[:<>]=\|||\|&&\||>\|<|\|[<>:]:\|<<\|>>>\?\|//\|[-=]>\|\.\.\.\?' . - \ '\|' . '\.\?[!' . s:op_chars . s:op_chars_wc . ']' . - \ '\)' - " Characters that can be used to start an identifier. Above \UBF we don't " bother checking. (If a UTF8 operator is used, it will take precedence anyway.) @@ -77,6 +72,12 @@ let s:id_charsW = '\%([0-9A-Za-z_!\UA2-\UA6\UA9\UAA\UAE-\UB0\UB2-\UB5\UB8-\UBA\U " A valid julia identifier, more or less let s:idregex = '\%(' . s:id_charsH . s:id_charsW . '*\)' +" Full operators regex +let s:operators = '\%(' . '\.\%([-+*/^÷%|&⊻]\|//\|\\\|>>\|>>>\?\)\?=' + \ . '\|' . '[!:<>]=\|||\|&&\||>\|<|\|[<>:]:\|<<\|>>>\?\|//\|[-=]>\|\.\.\.\?' + \ . '\|' . '\.!' . '\|'.s:id_charsW.'\@'.s:d(1).'" syntax match juliaInfixKeyword display "\%(=\s*\)\@\S\@!\%(\s*=\)\@!" -" The import/export/using keywords introduce a sort of special parsing +" The import/export/using/public keywords introduce a sort of special parsing " environment with its own rules -exec 'syntax region juliaImportLine matchgroup=juliaKeyword excludenl start="\<\%(import\|using\|export\)\>" skip="\%(\%(\<\%(import\|using\|export\)\>\)\|^\)\@'.s:d(6).'<=$" end="$" end="\%([])}]\)\@=" contains=@juliaExpressions,juliaAsKeyword,@juliaContinuationItems,juliaMacroName' +exec 'syntax region juliaImportLine matchgroup=juliaKeyword excludenl start="\<\%(import\|using\|export\|public\)\>" skip="\%(\%(\<\%(import\|using\|export\|public\)\>\)\|^\)\@'.s:d(6).'<=$" end="$" end="\%([])}]\)\@=" contains=@juliaExpressions,juliaAsKeyword,@juliaContinuationItems,juliaMacroName' syntax match juliaAsKeyword display contained "\" syntax match juliaRepKeyword display "\<\%(break\|continue\)\>" @@ -180,8 +181,9 @@ syntax region juliaLetBlock matchgroup=juliaBlKeyword start="\" end="\\|im\>\|\ze\X\)' -let s:float_regex = '\%(' . s:float_regex3 . - \ '\|' . s:float_regex2 . - \ '\|' . s:float_regex1 . - \ '\|' . s:hexfloat_regex2 . - \ '\|' . s:hexfloat_regex1 . - \ '\)' +let s:float_regex = '\%(' . s:float_regex3 + \ . '\|' . s:float_regex2 + \ . '\|' . s:float_regex1 + \ . '\|' . s:hexfloat_regex2 + \ . '\|' . s:hexfloat_regex1 + \ . '\)' exec 'syntax match juliaNumber contained "' . s:int_regex . '" contains=juliaComplexUnit' exec 'syntax match juliaFloat contained "' . s:float_regex . '" contains=juliaComplexUnit' @@ -386,13 +388,13 @@ syntax keyword juliaTodo contained TODO FIXME XXX " detect an end-of-line with only whitespace or comments before it let s:eol = '\s*\%(\%(\%(#=\%(=#\@!\|[^=]\|\n\)\{-}=#\)\s*\)\+\)\?\%(#=\@!.*\)\?\n' -" a trailing comma, or colon, or an empty line in an import/using/export +" a trailing comma, or colon, or an empty line in an import/using/export/public " multi-line command. Used to recognize the as keyword, and for indentation " (this needs to take precedence over normal commas and colons, and comments) syntax cluster juliaContinuationItems contains=juliaContinuationComma,juliaContinuationColon,juliaContinuationNone exec 'syntax region juliaContinuationComma matchgroup=juliaComma contained start=",\ze'.s:eol.'" end="\n\+\ze." contains=@juliaCommentItems' exec 'syntax region juliaContinuationColon matchgroup=juliaColon contained start=":\ze'.s:eol.'" end="\n\+\ze." contains=@juliaCommentItems' -exec 'syntax region juliaContinuationNone matchgroup=NONE contained start="\%(\<\%(import\|using\|export\)\>\|^\)\@'.s:d(6).'<=\ze'.s:eol.'" end="\n\+\ze." contains=@juliaCommentItems,juliaAsKeyword' +exec 'syntax region juliaContinuationNone matchgroup=NONE contained start="\%(\<\%(import\|using\|export\|public\)\>\|^\)\@'.s:d(6).'<=\ze'.s:eol.'" end="\n\+\ze." contains=@juliaCommentItems,juliaAsKeyword' exec 'syntax match juliaMacroName contained "@' . s:idregex . '\%(\.' . s:idregex . '\)*"' " the following are disabled by default, but