You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(links)!: allow granular highlighting of links (#965)
Previously, both link with and without description were highlighted only
with `@org.hyperlink` hl group, which was linked to `@markup.link.url`
by default.
Since Neovim also has `@markup.link` and `@markup.link.label` in
addition to `@markup.link.url`, use those hl groups accordingly.
1. `@org.hyperlink` for the non-important parts of link (square
brackets), and this hl group is now linked to `@markup.link`
2. `@org.hyperlink.url` for the actual url in the link. Hl group linked
to `@markup.link.url` by default
3. `@org.hyperlink.desc` for the link description. Hl group linked to
`@markup.link.label` by default
To return to the previous behavior, override `@org.hyperlink.url` and
`@org.hyperlink.desc` as suggested in the docs:
```
vim.api.nvim_create_autocmd('ColorScheme', {
pattern = '*',
callback = function()
-- Define own colors
vim.api.nvim_set_hl(0, '@org.hyperlink.url', { link = '@org.hyperlink' })
vim.api.nvim_set_hl(0, '@org.hyperlink.desc', { link = '@org.hyperlink' })
end
})
```
Copy file name to clipboardExpand all lines: docs/configuration.org
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2845,7 +2845,9 @@ The following highlight groups are used:
2845
2845
- =@org.code.delimiter=: code text delimiter =~= - linked to =@markup.raw=,
2846
2846
- =@org.verbatim=: =verbatim= text - linked to =@markup.raw=,
2847
2847
- =@org.verbatim.delimiter=: verbatim text delimiter === - linked to =@markup.raw=,
2848
-
- =@org.hyperlink=: =[[file:link]]= text - linked to =@markup.link.url=,
2848
+
- =@org.hyperlink=: link without description (example: =[[file:/this/is/link]]=) - linked to =@markup.link=,
2849
+
- =@org.hyperlink.url=: Url part of the link with description (example: =[[file:/this/is/url][description]]=) - linked to =@markup.link.url=,
2850
+
- =@org.hyperlink.desc=: Description part of the link with description (example: =[[file:/path/to/file][description]]=) - linked to =@markup.link.label=,
2849
2851
- =@org.latex=: Inline latex - linked to =@markup.math=,
2850
2852
- =@org.table.delimiter= - =|= and =-= delimiters in tables - linked to =@punctuation.special=,
2851
2853
- =@org.table.heading= - Table headings - linked to =@markup.heading=,
0 commit comments