From f3e2e718ec66e064b494b67ad90eadba69e00717 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 4 Feb 2026 07:12:13 +0800 Subject: [PATCH 1/2] vim-patch:c65643c: runtime(vim): Update ftplugin, fix option variable 'keywordprg' matching - Match &option, and &[lg]:option variables. - Match Ex commands after :bar. - Fix matching of pre and post context text. - Style - use '..' for string concatenation. fixes vim/vim#17567 closes: vim/vim#17653 https://github.com/vim/vim/commit/c65643cbec4f5a77a2d30232c64c258b5f0f5c09 Co-authored-by: Doug Kearns --- runtime/ftplugin/vim.vim | 55 ++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim index 95916fde5f..8a953075cd 100644 --- a/runtime/ftplugin/vim.vim +++ b/runtime/ftplugin/vim.vim @@ -1,11 +1,11 @@ " Vim filetype plugin " Language: Vim " Maintainer: Doug Kearns -" Last Change: 2025 Mar 05 " Former Maintainer: Bram Moolenaar -" Contributors: Riley Bruins ('commentstring'), +" Contributors: Riley Bruins ('commentstring') " @Konfekt " @tpope (s:Help()) +" Last Change: 2025 Aug 07 " 2025 Aug 16 by Vim Project set com depending on Vim9 or legacy script " 2026 Jan 26 by Vim Project set path to common Vim directories #19219 @@ -58,41 +58,42 @@ if !exists("*" .. expand("") .. "Help") function s:Help(topic) abort let topic = a:topic + " keyword is not necessarily under the cursor, see :help K + let line = getline('.') + let i = match(line, '\V' .. escape(topic, '\'), col('.') - len(topic)) + let pre = strpart(line, 0, i) + let post = strpart(line, i + len(topic)) + + " local/global option vars + if topic =~# '[lg]' && pre ==# '&' && post =~# ':\k\+' + let topic = matchstr(post, '\k\+') + endif + if get(g:, 'syntax_on', 0) let syn = synIDattr(synID(line('.'), col('.'), 1), 'name') if syn ==# 'vimFuncName' - return topic.'()' - elseif syn ==# 'vimOption' - return "'".topic."'" - elseif syn ==# 'vimUserAttrbKey' - return ':command-'.topic - elseif syn =~# 'vimCommand' - return ':'.topic + return topic .. '()' + elseif syn ==# 'vimOption' || syn ==# 'vimOptionVarName' + return "'" .. topic .. "'" + elseif syn ==# 'vimUserCmdAttrKey' + return ':command-' .. topic + elseif syn ==# 'vimCommand' + return ':' .. topic endif endif - let col = col('.') - 1 - while col && getline('.')[col] =~# '\k' - let col -= 1 - endwhile - let pre = col == 0 ? '' : getline('.')[0 : col] - - let col = col('.') - 1 - while col && getline('.')[col] =~# '\k' - let col += 1 - endwhile - let post = getline('.')[col : -1] - - if pre =~# '^\s*:\=$' - return ':'.topic + if pre =~# '^\s*:\=$' || pre =~# '\%(\\\||\)\@' + return '<' .. topic .. '>' elseif pre =~# '\\$' - return '/\'.topic + return '/\' .. topic elseif topic ==# 'v' && post =~# ':\w\+' - return 'v'.matchstr(post, ':\w\+') + return 'v' .. matchstr(post, ':\w\+') + elseif pre =~# '&\%([lg]:\)\=$' + return "'" .. topic .. "'" else return topic endif From 8f1667445e6c56a954c597b2e1177cc2bd6b1373 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 4 Feb 2026 07:13:42 +0800 Subject: [PATCH 2/2] vim-patch:ac5af8e: runtime(vim): Fix for :VimKeywordPrg when syntax does not match When using vim9-syntax plugin, :VimKeywordPrg does not lookup functions correctly, as it relies solely on syntax names to find the help topic. The syntax keyword used for builtin function is vi9FuncNameBuiltin in vim9-syntax plugin, not vimFuncName expected by :VimKeywordPrg, so the fallback rules apply, and there is no fallback rule for function calls. Fix by just checking if the first char after topic is '(', and if so assume help topic is a function. closes: vim/vim#19320 https://github.com/vim/vim/commit/ac5af8ecd3025c2739ab79f6b8529ea0415c1380 Co-authored-by: Mark Woods --- runtime/ftplugin/vim.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim index 8a953075cd..b716a06e1d 100644 --- a/runtime/ftplugin/vim.vim +++ b/runtime/ftplugin/vim.vim @@ -8,6 +8,7 @@ " Last Change: 2025 Aug 07 " 2025 Aug 16 by Vim Project set com depending on Vim9 or legacy script " 2026 Jan 26 by Vim Project set path to common Vim directories #19219 +" 2026 Feb 03 by Vim Project update s:Help to improve detecting functions #19320 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -82,7 +83,9 @@ if !exists("*" .. expand("") .. "Help") endif endif - if pre =~# '^\s*:\=$' || pre =~# '\%(\\\||\)\@