summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/ftplugin
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2026-04-10 08:23:48 +0800
committerGitHub <noreply@github.com>2026-04-10 08:23:48 +0800
commitb10ae3b72b269d2cfa060de970415b06b79777ca (patch)
tree3285fa52f8f3f22f43e0919f230e6807cbecd0f2 /runtime/ftplugin
parent10e385cf30f07d80a42abe30d36ebf065c496c99 (diff)
vim-patch:72cefe6: runtime(help): support highlighting groups in translated syntax doc (#38922)
closes: vim/vim#19942 https://github.com/vim/vim/commit/72cefe6b72c92b5f3686ee297277a2940cbb702f Also include a blank line change from https://github.com/vim/vim/commit/9d9381fb2804c426f88cd9b30650b94fc500d6bb Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Diffstat (limited to 'runtime/ftplugin')
-rw-r--r--runtime/ftplugin/help.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/runtime/ftplugin/help.lua b/runtime/ftplugin/help.lua
index d5384ecd51..7a484e2480 100644
--- a/runtime/ftplugin/help.lua
+++ b/runtime/ftplugin/help.lua
@@ -29,14 +29,18 @@ local function colorize_hl_groups(patterns)
vim.fn.setpos('.', save_cursor)
end
+local function help_bufname_match(bufname, path)
+ return vim.endswith(bufname, path .. '.txt') or bufname:find(path .. '%.%a%ax$')
+end
+
-- Add custom highlights for list in `:h highlight-groups`.
local bufname = vim.fs.normalize(vim.api.nvim_buf_get_name(0))
-if vim.endswith(bufname, '/doc/syntax.txt') then
+if help_bufname_match(bufname, '/doc/syntax') then
colorize_hl_groups({
{ start = [[\*group-name\*]], stop = '^======', match = '^(%w+)\t' },
{ start = [[\*highlight-groups\*]], stop = '^======', match = '^(%w+)\t' },
})
-elseif vim.endswith(bufname, '/doc/treesitter.txt') then
+elseif help_bufname_match(bufname, '/doc/treesitter') then
colorize_hl_groups({
{
start = [[\*treesitter-highlight-groups\*]],
@@ -44,11 +48,11 @@ elseif vim.endswith(bufname, '/doc/treesitter.txt') then
match = '^@[%w%p]+',
},
})
-elseif vim.endswith(bufname, '/doc/diagnostic.txt') then
+elseif help_bufname_match(bufname, '/doc/diagnostic') then
colorize_hl_groups({
{ start = [[\*diagnostic-highlights\*]], stop = '^======', match = '^(%w+)' },
})
-elseif vim.endswith(bufname, '/doc/lsp.txt') then
+elseif help_bufname_match(bufname, '/doc/lsp') then
colorize_hl_groups({
{ start = [[\*lsp-highlight\*]], stop = '^------', match = '^(%w+)' },
{ start = [[\*lsp-semantic-highlight\*]], stop = '^======', match = '^@[%w%p]+' },