Aaron wrote:
I've been swapping my subscribed addresses, so I apologize if this got posted more than once.

My question is casual, but I wasn't able to find anything on the FAQs or
Google, so I hope someone here can tell me if I'm nuts or not.

In my ideal world (which, so far, Vim has done an excellent job creating
for me), CSS definitions would be lightly, alternatingly shaded. Here at
work, we format our CSS files like so:

.selector         { property: value; property: value;
                    property: value; }
.selector         { property: value; }
.selector         { property: value; property: value;
                    property: value; property: value; }

You can see immediately that it is easy enough to scan down the left
column to find the selector you're interested in, but it's a bit more
difficult to see where one definition's property list starts and
another's ends (especially with syntax highlighting in there).

Is there some way, perhaps through a syntax rule, or rules, to have Vim
shade the background of *alternating* CSS definitions, assuming this
file format?

I'm handy with regex but I don't know if Vim's syntax system is even up
to the task. A function that ran against the buffer would be fine, too.

Thanks!


I don't know, but there is an easy way to find where one particular definition starts and ends:

1. Place the cursor on the opening brace (e.g. with /{ )
2. Hit V (i.e. shift-v) to enter linewise Visual mode
3. Hit % to move the cursor to the closing brace.

The whole selector and property list is now highlighted. You can even hit Esc to quit Visual mode and go back to it later with gv


Best regards,
Tony.

Reply via email to