Comments (9)
Works just fine for me, and since you’re getting the errors it would seem it’s even working for you.
Are you running another, naughty plugin that does clearmatches()
on the buffer?
If so, file a bug against it and tell the maintainer to make it keep track of which matches it owns instead of just bulldozing everyone’s matches. I.e. that plugin needs a line like the one you commented out (plus equivalents of line 222 and 257), instead of this plugin needing that line commented out. And this issue can be closed.
If not, then we’ll have to investigate further.
from vim-css-color.
Oh, I see. I'll reopen if it that's not the case, thanks!
from vim-css-color.
You were quite correct, sir, and it was my own, from before bothering to understand vimscript
https://github.com/torgeir/vim/blob/0d0704c4779c6a28ed3d3a31e53582b49997a846/config/trailingwhitespace.vim
Fixed, thanks! :)
https://github.com/torgeir/vim/blob/master/config/trailingwhitespace.vim
from vim-css-color.
I found it in the very popular Command-T: https://github.com/wincent/Command-T/blob/master/ruby/command-t/match_window.rb#L118
My chance of getting that fixed upstream are tiny, I guess.
from vim-css-color.
Are you sure? @wincent does not seem like someone who would need a lot of convincing on this. It doesn’t even seem hard to add, it seems he only ever adds three matches. Those would need to be replaced with calls to matchadd()
which returns an ID that can then be deleted selectively using matchdelete()
instead of nuking everything with clearmatches()
(just as vim-css-color does). Not much work. I might have a go at a patch myself, though I’d need to brush off my Ruby.
from vim-css-color.
No, not sure — I just assumed @wincent was the kind of guy who knew very well what he did, and that perhaps he had good reasons to do this way.
May I ask if you could submit the issue? I'm on thin ice here :) If not, I'll do my best.
The errors I'm getting are these:
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line 32:
E117: Unknown function: s:rgb2xterm
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line 32:
E15: Invalid expression: s:rgb2xterm(rgb_color)
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line 33:
E713: Cannot use empty key for Dictionary
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line 38:
E713: Cannot use empty key for Dictionary
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line 38:
E15: Invalid expression: s:hex[rgb_color[0:1]]
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line 39:
E713: Cannot use empty key for Dictionary
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line 39:
E15: Invalid expression: s:hex[rgb_color[2:3]]
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line 40:
E713: Cannot use empty key for Dictionary
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line 40:
E15: Invalid expression: s:hex[rgb_color[4:5]]
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line 41:
E121: Undefined variable: r
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line 41:
E15: Invalid expression: r*30 + g*59 + b*11 > 12000 ? s:black : s:white
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line 42:
E713: Cannot use empty key for Dictionary
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line 49:
E254: Cannot allocate color #
Press ENTER or type command to continue
Error detected while processing function <SNR>63_parse_css_screen..<SNR>63_create_syn_match:
line 49:
E417: missing argument: guifg=
Press ENTER or type command to continue
I'm seeing now that the ID not found
is not mention here, but I've seen that error too. Not sure if they're related. I'm editing a .less file and once I'm typing hsl(12, 12%, 12
, that's when the error pops up. Hoep I'm in the right place. Thanks.
from vim-css-color.
Ah, thanks for CC'ing me on this. I didn't even know I was doing it wrong; added the clearmatches
call misguidedly 4 years ago: wincent/command-t@d06f51f
I'll create an issue for this.
from vim-css-color.
Awesomesauce.
from vim-css-color.
@wincent: don’t feel bad – seems like just most people are doing it: someone else just found it in CtrlP, and I saw a clearmatches()
in some competing colour highlighter plugin myself. It’s no surprise either, Vim’s API is pretty much inviting the mistake. The only reason I’m not among everyone in this is because vim-css-color by definition coexists in a buffer alongside other more important plugins, so I knew I had to be circumspect in a way that might not have occurred to me if I was writing a plugin that I thought of as owning a buffer.
In fact I debated putting in a try
/catch
and silencing the error, because I can foresee this causing bug reports forever hence, since after all the Vim API invites the use of clearmatches()
. But OT1H, the reason I added the matchadd()
stuff was to support cursorline
users – if I accept those matches getting cleared away then that support may appear to work randomly only. And OTOH, those other plugins as written genuinely do not coöperate well with others within a buffer, when it comes to match highlighting, and probably ought to be fixed not just for the interests of vim-css-color alone. So I chose to leave vim-css-color exposed to exceptions and to accept going the boil-the-ocean route.
from vim-css-color.
Related Issues (20)
- E121: Undefined variable: b:css_color_pat in netrw
- Neovim tree sitter support HOT 20
- support for svelte files HOT 2
- Plugin is not compatible with nvim-treesitter HOT 1
- No colors in .h files in neovim
- It would be nice to support SVG files HOT 2
- create_matches function takes 1.4 s on large nix files
- NeoVim tree sitter support HOT 1
- Error with files with no highlightable targets in Vim9 HOT 4
- Erroring in java file HOT 2
- Add support for LaTeX? HOT 1
- Add support for template strings
- Does not work HOT 5
- incompatible with nvim-treesitter HOT 2
- [Feature request]: provide a command to make it asynchronous.
- truecolor terminals and termguicolors HOT 5
- Incorrect Highlighting of C Macros
- How to enable color highlighting for strings in CSS
- Error in C comments
- Support CSS Color Module Level 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-css-color.