From dffacf5c9d6f575ae324e49c38f1d8f82efa032b Mon Sep 17 00:00:00 2001 From: "J. Adly" <129727815+youssefadly237@users.noreply.github.com> Date: Fri, 19 Jun 2026 02:03:01 +0300 Subject: [PATCH] fix(man.lua): highlight codeblocks #40310 Problem: :Man does not syntax highlight codeblocks (injected language). Analysis: init_pager() swapped pcall(parse_ref, ref) return values order, so vim.b.man_sect was set to the manpage name instead of the section number, so C syntax highlighting did not load. Solution: Swap the calls. (cherry picked from commit 67b3cceaa70167b4ce1bfcee9b639d88a7134d54) --- runtime/lua/man.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua index 847a4d6510..ccb5fc2592 100644 --- a/runtime/lua/man.lua +++ b/runtime/lua/man.lua @@ -669,8 +669,8 @@ function M.init_pager() -- know the correct casing, cf. `man glDrawArraysInstanced`). --- @type string local ref = (fn.getline(1):match('^[^)]+%)') or ''):gsub(' ', '_') - local _, sect, err = pcall(parse_ref, ref) - vim.b.man_sect = err ~= nil and sect or '' + local ok, _, sect = pcall(parse_ref, ref) + vim.b.man_sect = ok and (sect or '') or '' local man_bufname = 'man://' .. fn.fnameescape(ref):lower()