-
Notifications
You must be signed in to change notification settings - Fork 81
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
Support for conf
ft files
#155
Comments
Glad you like it 🙂 There are multiple reasons the colours in that file do not get highlighted, and they all come down to the fact that the plugin goes to a lot of effort to avoid colourising things that aren’t actually colours. The first issue, which is not actually a problem, is that the plugin piggybacks on existing filetype syntax definitions to specify which portions of the syntax Vim should highlight – that way, f.ex., in CSS files, only colour names in property values get highlighted but not in property names. That requires supporting each filetype syntax individually. Since The second issue, which is also not necessarily a problem by itself, is that this won’t help you because the plugin currently only supports at most the following forms (regardless of filetype):
The third issue, probably still not a problem, is that the colour values in your file are not syntax-highlighted at all, as anything. The way that the piggybacking works currently is that the plugin’s However, this whole combination clashes with the overall goal of the plugin. Parsing arbitrary named 8-character hex strings as colours could be OK – if it were sufficiently constrained by the filetype syntax. But here that’s just a generic |
All that said, two things: betterlockscreen is just a shell script and the configuration is just read using However, there is still the “naked hex-string” issue. That could easily be fixed by @pavanjadhaw though by just changing the --inside-color=$insidecolor --ring-color=$ringcolor … it would have to strip the hash from the front if there is one: --inside-color=${insidecolor#\#} --ring-color=${ringcolor#\#} Then you could write your config like so (making sure every color is in a string):
… and either add the modeline or leave it out. (CSS Color would need a minor patch either way (as follows).) Then everything would work. --- /dev/null
+++ w/after/syntax/conf.vim
@@ -0,0 +1 @@
+call css_color#init( 'rgba', 'none', 'confString,confComment' )
diff --git i/after/syntax/sh.vim w/after/syntax/sh.vim
index 8d7d6189bc0..7e9fce012cb 100644
--- i/after/syntax/sh.vim
+++ w/after/syntax/sh.vim
@@ -1,5 +1,5 @@
-syn match shCommentColor contained '\(#[^#]*\)\@<=\zs#\x\{3}\%(\x\{3}\)\?\>' containedin=shQuickComment,shBQComment,shComment
-call css_color#init( 'hex', 'none'
+syn match shCommentColor contained '\(#[^#]*\)\@<=\zs#\%(\x\{3,4}\)\{1,2}\>' containedin=shQuickComment,shBQComment,shComment
+call css_color#init( 'rgba', 'none'
\, 'shSingleQuote,shDoubleQuote,shHereDoc,'
\. 'shTestSingleQuote,shTestDoubleQuote,'
\. 'shEchoQuote,shEmbeddedEcho,shEcho,' |
Alternatively, of course, if @pavanjadhaw doesn’t like changing betterlockscreen – since it’s just a shell script, you could add code to it to strip the hashmarks on your end (in any number of ways…). |
This is likely an edge case, so feel free to close this issue if it is not worth the trouble. Similarly if I somehow missed an issue that already addressed this, please also close this issue.
Now here's my use case:
I am editing the configuration file for my lockscreen (fork of
i3lock
) which is picked up by Vim asft=conf
, but the values are not highlighted. From my best guesses, there's 3 possible reasons I was able to imagine as to why this is happening:key=RGBA
Here is what this config looks like:
Although there is nothing interesting happening, I am also including a screenshot to show that these colors are not highlighted:
P.S. I love the plugin (in my few weeks of usage) quite a bit, thank you for your work developing this!
The text was updated successfully, but these errors were encountered: