{"id":13992086,"url":"https://github.com/atom/snippets","last_synced_at":"2025-12-18T02:40:21.431Z","repository":{"id":10043170,"uuid":"12089300","full_name":"atom/snippets","owner":"atom","description":"Atom snippets package","archived":true,"fork":false,"pushed_at":"2023-03-15T09:38:06.000Z","size":607,"stargazers_count":204,"open_issues_count":53,"forks_count":103,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-11-29T12:38:20.004Z","etag":null,"topics":["atom","autocomplete","snippets"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2013-08-13T18:31:37.000Z","updated_at":"2024-10-13T20:59:31.000Z","dependencies_parsed_at":"2024-01-15T16:52:22.989Z","dependency_job_id":null,"html_url":"https://github.com/atom/snippets","commit_stats":null,"previous_names":[],"tags_count":132,"template":false,"template_full_name":null,"purl":"pkg:github/atom/snippets","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atom%2Fsnippets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atom%2Fsnippets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atom%2Fsnippets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atom%2Fsnippets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atom","download_url":"https://codeload.github.com/atom/snippets/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atom%2Fsnippets/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266520631,"owners_count":23942307,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["atom","autocomplete","snippets"],"created_at":"2024-08-09T14:01:46.974Z","updated_at":"2025-12-18T02:40:21.367Z","avatar_url":"https://github.com/atom.png","language":"JavaScript","readme":"##### Atom and all repositories under Atom will be archived on December 15, 2022. Learn more in our [official announcement](https://github.blog/2022-06-08-sunsetting-atom/)\n # Snippets package\n[![macOS Build Status](https://travis-ci.org/atom/snippets.svg?branch=master)](https://travis-ci.org/atom/snippets) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/8hlc0onofkgbxw53/branch/master?svg=true)](https://ci.appveyor.com/project/Atom/snippets/branch/master) [![Dependency Status](https://david-dm.org/atom/snippets.svg)](https://david-dm.org/atom/snippets)\n\nExpand snippets matching the current prefix with \u003ckbd\u003etab\u003c/kbd\u003e in Atom.\n\nTo add your own snippets, select the _Atom \u003e Snippets..._ menu option if you're using macOS, or the _File \u003e Snippets..._ menu option if you're using Windows, or the _Edit \u003e Snippets..._ menu option if you are using Linux.\n\n## Snippet Format\n\nSnippets files are stored in a package's `snippets/` folder and also loaded from `~/.atom/snippets.cson`. They can be either `.json` or `.cson` file types.\n\n```coffee\n'.source.js':\n  'console.log':\n    'prefix': 'log'\n    'body': 'console.log(${1:\"crash\"});$2'\n```\n\nThe outermost keys are the selectors where these snippets should be active, prefixed with a period (`.`) (details below).\n\nThe next level of keys are the snippet names.\n\nUnder each snippet name is a `prefix` that should trigger the snippet and a `body` to insert when the snippet is triggered.\n\n`$` followed by a number are the tabs stops which can be cycled between by pressing \u003ckbd\u003etab\u003c/kbd\u003e once a snippet has been triggered.\n\nThe above example adds a `log` snippet to JavaScript files that would expand to.\n\n```js\nconsole.log(\"crash\");\n```\n\nThe string `\"crash\"` would be initially selected and pressing tab again would place the cursor after the `;`\n\n### Optional parameters\nThese parameters are meant to provide extra information about your snippet to [autocomplete-plus](https://github.com/atom/autocomplete-plus/wiki/Provider-API).\n\n* `leftLabel` will add text to the left part of the autocomplete results box.\n* `leftLabelHTML` will overwrite what's in `leftLabel` and allow you to use a bit of CSS such as `color`.\n* `rightLabelHTML`. By default, in the right part of the results box you will see the name of the snippet. When using `rightLabelHTML` the name of the snippet will no longer be displayed, and you will be able to use a bit of CSS.\n* `description` will add text to a description box under the autocomplete results list.\n* `descriptionMoreURL` URL to the documentation of the snippet.\n\n![autocomplete-description](http://i.imgur.com/cvI2lOq.png)\n\nExample:\n```coffee\n'.source.js':\n  'console.log':\n    'prefix': 'log'\n    'body': 'console.log(${1:\"crash\"});$2'\n    'description': 'Output data to the console'\n    'rightLabelHTML': '\u003cspan style=\"color:#ff0\"\u003eJS\u003c/span\u003e'\n```\n\n### Determining the correct scope for a snippet\n\nThe outmost key of a snippet is the \"scope\" that you want the descendent snippets to be available in. The key should be prefixed with a period (`text.html.basic` =\u003e `.text.html.basic`). You can find out the correct scope by opening the Settings (\u003ckbd\u003ecmd-,\u003c/kbd\u003e on macOS) and selecting the corresponding *Language [xxx]* package, e.g. for *Language Html*:\n\n![Screenshot of Language Html settings](https://cloud.githubusercontent.com/assets/1038121/5137632/126beb66-70f2-11e4-839b-bc7e84103f67.png)\n\nIf it's difficult to determine the package handling the file type in question (for example, for `.md`-documents), you can also proceed as following. Put your cursor in a file in which you want the snippet to be available, open the [Command Palette](https://github.com/atom/command-palette)\n(\u003ckbd\u003ecmd-shift-p\u003c/kbd\u003e), and run the `Editor: Log Cursor Scope` command. This will trigger a notification which will contain a list of scopes. The first scope that's listed is the scope for that language. Here are some examples: `source.coffee`, `text.plain`, `text.html.basic`.\n\n### Snippet syntax\n\nThis package supports a subset of the features of TextMate snippets, [documented here](http://manual.macromates.com/en/snippets#transformations).\n\nThe following features are not yet supported:\n\n* Variables\n* Interpolated shell code\n* Conditional insertions in transformations\n\n### Multi-line Snippet Body\n\nYou can also use multi-line syntax using `\"\"\"` for larger templates:\n\n```coffee\n'.source.js':\n  'if, else if, else':\n    'prefix': 'ieie'\n    'body': \"\"\"\n      if (${1:true}) {\n        $2\n      } else if (${3:false}) {\n        $4\n      } else {\n        $5\n      }\n    \"\"\"\n```\n\n### Escaping Characters\n\nIncluding a literal closing brace inside the text provided by a snippet's tab stop will close that tab stop early. To prevent that, escape the brace with two backslashes, like so:\n\n```coffee\n'.source.js':\n  'function':\n    'prefix': 'funct'\n    'body': \"\"\"\n      ${1:function () {\n        statements;\n      \\\\}\n      this line is also included in the snippet tab;\n      }\n      \"\"\"\n```\n\n### Multiple snippets for the same scope\n\nSnippets for the same scope must be placed within the same key. See [this section of the Atom Flight Manual](http://flight-manual.atom.io/using-atom/sections/basic-customization/#configuring-with-cson) for more information.\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatom%2Fsnippets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatom%2Fsnippets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatom%2Fsnippets/lists"}