feat(defaults): pretty :help headings #30544

Problem:
Headings in :help do not stand out visually.

Solution:
Define a non-standard `@markup.heading.1.delimiter` group and
special-case it in `highlight_group.c`.

FUTURE:
This is a cheap workaround until we have #25718 which will enable:
- fully driven by `vimdoc/highlights.scm` instead of using highlight
  tricks (`guibg=bg guifg=bg guisp=fg`)
- better support of "cterm" ('notermguicolors')
This commit is contained in:
Justin M. Keyes
2024-09-27 08:53:30 -07:00
committed by GitHub
parent f55213ce0e
commit 09d76afe84
6 changed files with 48 additions and 4 deletions

View File

@@ -119,6 +119,9 @@ API
DEFAULTS
• Highlighting:
• Improved styling of :checkhealth and :help buffers.
• Mappings:
• |grn| in Normal mode maps to |vim.lsp.buf.rename()|
• |grr| in Normal mode maps to |vim.lsp.buf.references()|

View File

@@ -1,7 +1,7 @@
-- use treesitter over syntax (for highlighted code blocks)
vim.treesitter.start()
-- add custom highlights for list in `:h highlight-groups`
-- 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
require('vim.vimhelp').highlight_groups({

View File

@@ -1,9 +1,9 @@
(h1
(delimiter) @markup.heading.1
(delimiter) @markup.heading.1.delimiter
(heading) @markup.heading.1)
(h2
(delimiter) @markup.heading.2
(delimiter) @markup.heading.2.delimiter
(heading) @markup.heading.2)
(h3

View File

@@ -15,7 +15,7 @@ set cpo&vim
syn match helpHeadline "^[A-Z.][-A-Z0-9 .,()_']*?\=\ze\(\s\+\*\|$\)"
syn match helpSectionDelim "^===.*===$"
syn match helpSectionDelim "^---.*--$"
" Neovim: support language annotation in codeblocks
" Nvim: support language annotation in codeblocks
if has("conceal")
syn region helpExample matchgroup=helpIgnore start=" >[a-z0-9]*$" start="^>[a-z0-9]*$" end="^[^ \t]"me=e-1 end="^<" concealends
else