Files
neovim/runtime/ftplugin/checkhealth.lua
Marcus Caisey c4285acb92 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.
2026-05-11 15:14:52 -04:00

25 lines
933 B
Lua

vim.keymap.set('n', 'gO', function()
require('vim.treesitter._headings').show_toc(6)
end, { buf = 0, silent = true, desc = 'Show an Outline of the current buffer' })
vim.keymap.set('n', ']]', function()
require('vim.treesitter._headings').jump({ count = 1, level = 1 })
end, { buf = 0, silent = false, desc = 'Jump to next section' })
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<'