Closed micangl closed 1 month ago
Good idea; although I don't really like the default groups here. I would choose groups that don't set the background colors by default. In particular, I would choose one of the groups from :help group-names
, perhaps PreProc
or Define
for the default group and Special
for the important group.
Also, I would actually rather prefer to keep the keys more neutral and perhaps instead highlight the values differently. That is, have something like this:
local defaults = {
additional_information = {
highlight_colors = {
key_group = "PreProc",
value_group = "String",
important_value_group = "Identifier",
},
The syntax matching will be somewhat more complex, but I don't think it will be very hard.
Do you think that the ability to set guifg
and guibg
with the actual color codes should be removed? I almost feel that it may be excessive for this plugin (i.e., that the user should simply be able to specify a group).
Good question. My intuition is the same as you, that the user should instead learn to specify their own highlight groups directly.
I've been trying to write functioning syntax rules to highlight a row of the following kind:
TITLE: some_text
I've tried, without success:
syntax keyword CmpVimtexTitle TITLE
syntax match CmpVimtexTitleBody "TITLE: .*$"ms=s+7
But it doesn't work: it matches only TITLE
, even though I've put the match offset in the second command.
I would try something like this:
syntax match CmpVimtexTitle "^TITLE:\s*"
\ nextgroup=CmpVimtexTitleBody
\ contains=CmpVimtexColon
syntax match CmpVimtexTitleBody ".*" contained
syntax match CmpVimtexColon ":" contained
I've added a match for the colon, as I think it makes sense to highlight it differently. This idea should work for everything that is a single line. If you need for the body to match multiple lines you need to do something more advanced here.
Ok, I've updated it. I'll write the documentation when I can, and then merge with master if everything's fine.
Thanks for the help, as usual!
Glad to help :)
On a sidenote, would you mind if I asked you to post about the plugin in the main subreddits? I'd like to get as many users on board as possible to start troubleshooting eventual bugs, and receive suggestions for new features. I've seen that the (Neo)vim and Latex communities are pretty big, but I don't really use it.
I can make a post on r/neovim; I don't think it makes sense to post on r/vim as nvim-cmp does not work there.
Edit: Here it is: https://www.reddit.com/r/neovim/comments/1b5l5cm/cmpvimtex_a_vimtex_source_for_nvimcmp/
Thanks!
In the new branch![2024-02-23T17:40:20,979233542+01:00](https://github.com/micangl/cmp-vimtex/assets/142919381/4afdcdcf-8b7c-448f-b465-ada88418a660)
test_highlighting
is available a feature I had wanted to implement for some time. Basically, it highlights the bibliographic keys in the documentation windows:I haven't written the documentation yet. This is the relevant part of the configuration:
This may interest @lervag and @benbrastmckie.