changing the Emmet's auto complete

1k views Asked by At

I use sublime text as an editor for my html5 code, i also use Emmet to speed up my coding through Emmet's auto completion. In a blank .HTML file when i press control + space it generates the following code for me:

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
</body>
</html>

Now i just thought of it as generating some more code of my choice as i press control + space. I want it to generate this code:

<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
    <meta charset = "utf-8"/>
    <meta name = "viewport" content="width = device-width, intial-scale = 1.0">
    <link rel="" href="">
</head>
<body>
    <script src = ""></script>
</body>
</html>

Is it possible to change some configurations?

1

There are 1 answers

1
matuzo On BEST ANSWER

You can create your own or edit existing Emmet snippets by editing the Emmet user settings file. You can open this file directly from Sublime Text (Sublime Text > Preferences > Package Settings > Emmet > Settings – User). By default it is empty and you need to add this structure:

{
  "snippets": {
    "html": {
      "abbreviations": {
        "mytrigger": "!!!+html>head+body"
      }
    }
  }
}

New snippets are defined within the abbreviations object. In this example the HTML will be generated by typing mytrigger and hitting tab in an HTML document. All abbreviations are online on GitHub.

Also there's an example on my GitHub page.