emmet-vim
emmet-vim copied to clipboard
Class and id shorthand overrides
https://docs.emmet.io/customization/snippets/#variables
Together with ID and CLASS attributes shorthands—# and .—you can easily override variables right in abbreviation:
"for": "for (var ${class} = 0; i < ${id}.length; ${class}++) {\n\t|}" Example usage: for#array.i.
I'd like to be able to override shorthands such as #
and .
by using ${class}
or ${id}
.
The end goal being I'd be able to type something like for jss in jsx.
"div": "<div className={classes.${class}}>${cursor}</div>"
Example usage: div.foo
Becomes: <div className={classes.foo}>
Is this already implemented? It doesn't seem to work. I've found where the cursor is parsed. What would be a good way to implement the above?
Also bumping into this, but new to emmet so might be missing something obvious.
The emmet docs talk about how you can pass variables through like so:
html:5[lang=ru]
—> <!doctype html>\n<html lang="${lang}">...</body>\n</html>
But that example which is supposed to work out of the box, doesn't work (if you pass a variable override it keeps the old default of en
), so custom snippets passing variables in a similar way definitely won't (as far as I understand).
It seems that passing variables in snippets hasn't been added to emmet-vim
yet from what I can tell.