Commit b371b9e
authored
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
})
```1 parent e66a641 commit b371b9e
File tree
3 files changed
+8
-4
lines changed- docs
- lua/orgmode/colors
- queries/org
3 files changed
+8
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2845 | 2845 | | |
2846 | 2846 | | |
2847 | 2847 | | |
2848 | | - | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
2849 | 2851 | | |
2850 | 2852 | | |
2851 | 2853 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
| 46 | + | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
0 commit comments