mirror of
https://github.com/neovim/neovim
synced 2025-07-15 16:51:49 +00:00
fix(runtime): conceal paths in help, man ToC loclist #33764
Problem:
The check for concealing paths in TOCs in the qf syntax file fails
because the TOC tile has changed.
Solution:
Force the qf syntax file to be reloaded after the qf_toc variable
has been set, so that the it can apply the correct settings.
Using the explicit qf_toc key, already used in the syntax file, instead
of the title is less prone to breaking.
It was also already being set for man pages but it had no effect because
the syntax file had already been loaded when the variable was set.
Fixes #33733
(cherry picked from commit f048298e9a
)
This commit is contained in:
committed by
github-actions[bot]
parent
6b69b3217b
commit
2b2a3449f7
@ -810,6 +810,8 @@ function M.show_toc()
|
||||
fn.setloclist(0, {}, 'a', { title = 'Table of contents' })
|
||||
vim.cmd.lopen()
|
||||
vim.w.qf_toc = bufname
|
||||
-- reload syntax file after setting qf_toc variable
|
||||
vim.bo.filetype = 'qf'
|
||||
end
|
||||
|
||||
return M
|
||||
|
@ -86,6 +86,7 @@ end
|
||||
--- Shows an Outline (table of contents) of the current buffer, in the loclist.
|
||||
function M.show_toc()
|
||||
local bufnr = api.nvim_get_current_buf()
|
||||
local bufname = api.nvim_buf_get_name(bufnr)
|
||||
local headings = get_headings(bufnr)
|
||||
if #headings == 0 then
|
||||
return
|
||||
@ -102,6 +103,9 @@ function M.show_toc()
|
||||
vim.fn.setloclist(0, headings, ' ')
|
||||
vim.fn.setloclist(0, {}, 'a', { title = 'Table of contents' })
|
||||
vim.cmd.lopen()
|
||||
vim.w.qf_toc = bufname
|
||||
-- reload syntax file after setting qf_toc variable
|
||||
vim.bo.filetype = 'qf'
|
||||
end
|
||||
|
||||
--- Jump to section
|
||||
|
Reference in New Issue
Block a user