-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Highlight the dots in dotted keys #52
Conversation
Thanks for the PR @nastevens! It's hard for me to get excited about this change. In general I don't find that highlighting each last little bit of syntax is useful for readability, and it can get busy (and slow, if taken to the extreme). In my experience highlighting these sorts of "namespacing operators" isn't all too common -- do you have other examples you can point to where vanilla vim does special highlighting for similar constructs? For instance, in this screenshot of C++ code, you can see that neither the If we do make this change, I think that for consistency it should also apply to keys that are the names of tables or table arrays: |
31e240b
to
4d48298
Compare
Probably the best example, since it's also primarily a data language, is YAML. It does highlight the Rust highlights namespace operators like One weird note on the Rust hightlighting - in A cursory review of some other languages shows there's not a whole lot of consistency on the subject. Here's the summary: Namespace highlighting
No namespace highlighting
I was running everything on vim 8.1.2269 with
Totally agree, I've pushed a change that does this. |
@a-vrma could you take a look at this? |
I quite like this. The attached image compares The color change can help people parse the pi example as a key inside a table rather than a decimal. It also helps with the quoted IP address. I also like that you used the EDIT: I also like this because matching a dot in the key will make it easier to fix #58. |
Signed-off-by: Nick Stevens <[email protected]>
4d48298
to
3d10ab4
Compare
Thanks for the patch! |
TOML supports the dotted-key notation for defining keys within subtables as described in the "Keys" section of the spec
This adds a highlight to the dots in dotted-keys by setting the dot's style to
Normal
. The result of this highlight is subtle, but very helpful for picking out the levels of a dotted-key.