Create color with emmet abbreviation

Viewed 327

My vim's version is 8.2,vim-emmet version is 0.86.
How to write the abbreviation for the CSS as below?

border: 1px solid #dcd2ba;

In the manual it says that:

css abbreviation

For example, bd5#0s expands to border: 5px #000 solid: the # sign separates color from 5 and since s (alias to solid) is not a hexadecimal character, it can be used without - value separator.

Why in my vim,bd5#0s expand nothing?
And a strange expansion happened in my vim:

bd1s

expanded into

border-break: close;

and

bd1 s

expanded into

border: 1px solid #000;

BUT

bd2 s 

expanded into

box-shadow: inset hoff voff blur spread rgb(0, 0, 0);    

instead of

border: 2px solid #000;

Which configuration is wrong for my emmet? and How to check out and fix it?

2 Answers

The emmet documentation describes how to add hex colors. See https://docs.emmet.io/css-abbreviations/

bd5#0s expands to border: 5px #000 solid: the # sign separates color from 5 and since s (alias to solid) is not a hexadecimal character, it can be used without - value separator.

So in your case use bd1#dcd2bas

I took a look in the source code, I don't think... it's bug free.

The actual rule for the border statement:

"bd+": "border:${1:1px} ${2:solid} ${3:#000};",

which would suggest that the correct order is with color at the end, but in my testing I couldn't make it to work. Also I tried adding a alias for s=solid, which it is stated that exists, but I could not find it in the source code.

Also some other example of the doc, do not work at the moment.

I conclude, in my opinion, it is just broken. (I would suggest you to add your own snippet.)

Related