]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(help): Update syntax, add vim9 example language
authorDoug Kearns <dougkearns@gmail.com>
Sun, 28 Sep 2025 18:06:04 +0000 (18:06 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 28 Sep 2025 18:09:38 +0000 (18:09 +0000)
"vim9" is Vim9 script and "vim" is legacy script.

See: https://github.com/vim/vim/pull/18350#discussion_r2372462539

closes: #18407

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/helphelp.txt
runtime/doc/usr_05.txt
runtime/doc/usr_52.txt
runtime/syntax/generator/vim.vim.base
runtime/syntax/help.vim
runtime/syntax/vim.vim

index ef70be7709aa2b782336984a9e9b92285c6845d2..ac57264b84e358a4a8e26184479b2ea4174e29ec 100644 (file)
@@ -1,4 +1,4 @@
-*helphelp.txt* For Vim version 9.1.  Last change: 2025 Sep 15
+*helphelp.txt* For Vim version 9.1.  Last change: 2025 Sep 27
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -463,12 +463,14 @@ To quote a block of ex-commands verbatim, place a greater than (>) character
 at the end of the line before the block and a less than (<) character as the
 first non-blank on a line following the block.  Any line starting in column 1
 also implicitly stops the block of ex-commands before it.  E.g. >
+
        function Example_Func()
          echo "Example"
        endfunction
 <
 To enable syntax highlighting for a block of code, place a language name
 annotation (e.g. "vim") after a greater than (>) character.  E.g. >vim
+
        function Example_Func()
          echo "Example"
        endfunction
@@ -476,7 +478,8 @@ annotation (e.g. "vim") after a greater than (>) character.  E.g. >vim
                                                *g:help_example_languages*
 By default, help files only support Vim script highlighting.  If you need
 syntax highlighting for other languages, add to your |vimrc|: >
-       :let g:help_example_languages = { "vim": "vim", "sh": "bash" }
+       :let g:help_example_languages = {
+             \ "vim": "vim", "vim9": "vim", "bash": "sh" }
 The key represents the annotation marker name, and the value is the 'syntax'
 name.
 
index fea6cddd19d434f71b009b748c89f57b0f6d4f15..5b52bc654410b001e9ae0a55bb880aa232b254c1 100644 (file)
@@ -1,4 +1,4 @@
-*usr_05.txt*   For Vim version 9.1.  Last change: 2025 Apr 10
+*usr_05.txt*   For Vim version 9.1.  Last change: 2025 Sep 27
 
                     VIM USER MANUAL - by Bram Moolenaar
 
@@ -308,6 +308,7 @@ This switches on three very clever mechanisms:
 
 
                                *restore-cursor* *last-position-jump*  >vim
+
     augroup RestoreCursor
       autocmd!
       autocmd BufReadPost *
index 19a37dca5e3a15c7ef682a416dc54253c1223ae3..9066838119ddc95d3ecc416b33832934ba154efd 100644 (file)
@@ -1,4 +1,4 @@
-*usr_52.txt*   For Vim version 9.1.  Last change: 2025 Mar 17
+*usr_52.txt*   For Vim version 9.1.  Last change: 2025 Sep 27
 
                     VIM USER MANUAL - by Bram Moolenaar
 
@@ -347,7 +347,7 @@ Have a look at the package located at $VIMRUNTIME/pack/dist/opt/comment/
 HIGHLIGHT YANK PLUGIN
 
 Vim comes with the highlight-yank plugin, written in Vim9 script
-|hlyank-install|, here is a simplified implementation: >vim
+|hlyank-install|, here is a simplified implementation: >vim9
 
        vim9script
 
index 461eafb11f93f911e6b2b0030bbba2e76055a1ca..fbca93451ddcbad26ae3e192f9dcd41f910d0c0a 100644 (file)
@@ -18,7 +18,8 @@ set cpo&vim
 
 " Feature testing {{{1
 
-let s:vim9script = "\n" .. getline(1, 32)->join("\n") =~# '\n\s*vim9\%[script]\>'
+" NOTE: vimsyn_force_vim9 for internal use only
+let s:vim9script = get(b:, "vimsyn_force_vim9", v:false) || "\n" .. getline(1, 32)->join("\n") =~# '\n\s*vim9\%[script]\>'
 
 function s:has(feature)
   return has(a:feature) || index(get(g:, "vimsyn_vim_features", []), a:feature) != -1
index c53c0cb906be9b5e118d0e7070f765428831292d..35b4572bfaaf32de69e29098a47aba147484a04f 100644 (file)
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:            Vim help file
 " Maintainer:          Doug Kearns <dougkearns@gmail.com>
-" Last Change:         2025 Jul 20
+" Last Change:         2025 Sep 27
 " Former Maintainer:   Bram Moolenaar <Bram@vim.org>
 
 " Quit when a (custom) syntax file was already loaded
@@ -15,7 +15,7 @@ set cpo&vim
 syn iskeyword @,48-57,_,192-255
 
 if !exists('g:help_example_languages')
-  let g:help_example_languages = #{ vim: 'vim' }
+  let g:help_example_languages = #{ vim: 'vim', vim9: 'vim' }
 endif
 
 syn match helpHeadline         "^[A-Z.][-A-Z0-9 .,()_']*?\=\ze\(\s\+\*\|$\)"
@@ -32,10 +32,19 @@ endif
 
 for [s:lang, s:syntax] in g:help_example_languages->items()
   unlet! b:current_syntax
+
+  if s:lang == "vim9"
+    let b:vimsyn_force_vim9 = v:true
+  endif
+
   " silent! to prevent E403
   execute 'silent! syn include' $'@helpExampleHighlight_{s:lang}'
         \ $'syntax/{s:syntax}.vim'
 
+  if s:lang == "vim9"
+    unlet b:vimsyn_force_vim9
+  endif
+
   execute $'syn region helpExampleHighlight_{s:lang} matchgroup=helpIgnore'
         \ $'start=/\%(^\| \)>{s:lang}$/'
         \ 'end=/^[^ \t]/me=e-1 end=/^</'
index 06949222b46a8a267129d6521003b4399f133a24..426674e97625dfa548da4c0a2d4a2f6fd7dbeed0 100644 (file)
@@ -18,7 +18,8 @@ set cpo&vim
 
 " Feature testing {{{1
 
-let s:vim9script = "\n" .. getline(1, 32)->join("\n") =~# '\n\s*vim9\%[script]\>'
+" NOTE: vimsyn_force_vim9 for internal use only
+let s:vim9script = get(b:, "vimsyn_force_vim9", v:false) || "\n" .. getline(1, 32)->join("\n") =~# '\n\s*vim9\%[script]\>'
 
 function s:has(feature)
   return has(a:feature) || index(get(g:, "vimsyn_vim_features", []), a:feature) != -1