mattn / emmet-vim

emmet for vim: http://emmet.io/
http://mattn.github.io/emmet-vim
MIT License
6.41k stars 410 forks source link

[Feature request] Including snippets from different filetypes in a single filetype. #473

Open ghost opened 4 years ago

ghost commented 4 years ago

When testing some css properties, I use to write the some internal css in a html file. Therefore, I would like to have the css snippets in a buffer whose filetype is html. This feature request has already been indirectly requested (see these posted issues: 388 and 444.

It would be really useful if we could enable snippets from different filetypes in a single buffer. For example, let's suppose that I enable css snippets in html. Therefore, pressing bg<c-y>' would yield to

bg {

}

instead of

<bg></bg>

In abstract terms, it would be nice if we could define the filetype whose list of snippets will also be included for a given filetype (see example below)

let g:user_emmet_compound_filetypes = {
    \ 'html': ['css'],
    \ 'javascript.jsx': ['css']
    \}

This configuration variable would make css snippets to also be included when loading a buffer with a html filetype. In addition to this, since there are filetypes that have same snippets triggers

setting a priority for the group of snippets would give the user more flexibility. For example

let g:user_emmet_compound_filetypes = {
    \ 'html': ['jade', 'html']
    \}

would imply that jade snippets have greater priority than html snippets.