mattn / emmet-vim

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

Enhance html5 expansion? #422

Open bulletmark opened 6 years ago

bulletmark commented 6 years ago

Both VS Code and Atom expand html5 (i.e. !) to the following:

<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>

</body>
</html>

However, emmet-vim (current master branch) expands to the lesser:

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>

</body>
</html>

Can we have this expansion enhanced to the above?

mattn commented 6 years ago

emmet-vim expand as same as https://docs.emmet.io/

And you can modify default configuration.

let g:user_emmet_settings = {
\  'html': {
\    'snippets': {
\      'html:5': 'you expected'
\    }
\ }
\}
bulletmark commented 6 years ago

Actually, doesn't expand exactly as emmet docs. There is a missing Document in the title line, like VS Code and ATOM have.

Both VS Code and Atom don't seem to care about that compatibility. Why must emmet-vim?

Arb-aya commented 4 years ago

For those of you looking how to achieve this you can add the following to your .vimrc:

let g:user_emmet_settings = {                                                                                                                                                             
\  'html': {                                                                                                                                                      
\    'snippets': {                                                                                                                                                
\      'html:5': '!!!+html>(head>(meta[charset=${charset}]+meta[name="viewport" content="width=device-width,initial-scale=1.0"]+meta[http-equiv="X-UA-Compatible" content="ie=edge"]+title +body'                                                                                                                                                          
    \}                                                                                                                                                                
 \}                                                                                                                                                                
\}    
ProfKache commented 2 years ago

Thanks. Life saver.