fix(health): set 'tags' for help filetype #39742

Problem:
The `:checkhealth` buffer uses the help syntax, so help tag links (e.g.
`|clipboard|`) are highlighted like they are in help buffers. However,
unlike in help buffers, `CTRL-]` doesn't jump to the relevant help file.

I expect that if the `:checkhealth` buffer looks like a help buffer,
then it should behave like one where it makes sense. This comment from
/r/neovim suggests that this was the intention:
https://www.reddit.com/r/neovim/comments/5ghv3r/see_clipboard_how/dascnry/.

Solution:
Set `'tags'` in `checkhealth` buffers so that `:tag` and friends look
for tags in the help tags files.
This commit is contained in:
Marcus Caisey
2026-05-11 20:14:52 +01:00
committed by GitHub
parent 11084f5db3
commit c4285acb92

View File

@@ -9,6 +9,16 @@ vim.keymap.set('n', '[[', function()
require('vim.treesitter._headings').jump({ count = -1, level = 1 })
end, { buf = 0, silent = false, desc = 'Jump to previous section' })
-- Look for tags in help tags files
vim.bo.tags = vim
.iter(vim.api.nvim_get_runtime_file('doc/tags doc/tags-??', true))
:map(vim.fn.fnameescape)
:map(function(path)
return vim.fn.escape(path, ',')
end)
:join(',')
vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '')
.. '\n sil! exe "nunmap <buffer> gO"'
.. '\n sil! exe "nunmap <buffer> ]]" | sil! exe "nunmap <buffer> [["'
.. '\n setlocal tags<'