All Projects → atom → Snippets

atom / Snippets

Licence: mit
Atom snippets package

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Snippets

Kotlin Language Server
Intelligent Kotlin support for any editor/IDE using the Language Server Protocol
Stars: ✭ 650 (+240.31%)
Mutual labels:  atom, autocomplete
Autocomplete Ruby
Provides intelligent code completion for Ruby in the Atom editor. Requires RSense.
Stars: ✭ 50 (-73.82%)
Mutual labels:  atom, autocomplete
Vuejs Snippets
Collection of Vuejs 2.0+ snippets
Stars: ✭ 17 (-91.1%)
Mutual labels:  atom, snippets
Graphql For Vscode
GraphQL syntax highlighting, linting, auto-complete, and more!
Stars: ✭ 265 (+38.74%)
Mutual labels:  snippets, autocomplete
Ncm R
R autocompletion for Neovim and vim 8 📝 📊 ⚡️
Stars: ✭ 102 (-46.6%)
Mutual labels:  snippets, autocomplete
Dotfiles
Setup and install scripts for a new machine + dotfiles for various apps. Linux, Mac, and Mac (Amazon specific) branches are included.
Stars: ✭ 382 (+100%)
Mutual labels:  atom, snippets
Language Dot
Dot (Graphviz) package for Atom
Stars: ✭ 11 (-94.24%)
Mutual labels:  atom, snippets
sublime-PICO-8
PICO-8 plugin for the Sublime Text 3 editor.
Stars: ✭ 42 (-78.01%)
Mutual labels:  snippets, autocomplete
Atom Turbo Javascript
Commands and snippets for faster Javascript and Typescript with the Atom Editor
Stars: ✭ 100 (-47.64%)
Mutual labels:  atom, snippets
Atom Ava
Snippets for AVA and run tests directly in the editor
Stars: ✭ 96 (-49.74%)
Mutual labels:  atom, snippets
React Native Snippets
✏️ A collection of React Native snippets for Sublime Text and Atom
Stars: ✭ 257 (+34.55%)
Mutual labels:  atom, snippets
Ironpython Stubs
Autocomplete stubs for common IronPython/.NET libraries
Stars: ✭ 135 (-29.32%)
Mutual labels:  atom, autocomplete
30-seconds-of-code-texteditorsnippets
Files to import the 30-seconds-of-code snippets into VSCode, Atom and Sublime.
Stars: ✭ 35 (-81.68%)
Mutual labels:  atom, snippets
Sublimecodeintel
💡 Full-featured code intelligence and smart autocomplete for Sublime Text
Stars: ✭ 5,050 (+2543.98%)
Mutual labels:  snippets, autocomplete
pymolsnips
Pymolsnips is a library of PyMOL scripting language code fragments for several popular text editors.
Stars: ✭ 19 (-90.05%)
Mutual labels:  atom, snippets
Atom Modular Snippets
:atom: A modular solution to snippets in @Atom.
Stars: ✭ 8 (-95.81%)
Mutual labels:  atom, snippets
atom-perl6-editor-tools
A collection of useful Perl 6 editor tools
Stars: ✭ 19 (-90.05%)
Mutual labels:  atom, snippets
CodeView
Android Library to make it easy to create an Code editor or IDE that support any languages and themes, with auto complete, auto indenting, snippets and more features
Stars: ✭ 254 (+32.98%)
Mutual labels:  snippets, autocomplete
Atom Latex
The only LaTeX package you need for typesetting with Atom.
Stars: ✭ 60 (-68.59%)
Mutual labels:  atom, autocomplete
Go Plus
An Enhanced Go Experience For The Atom Editor
Stars: ✭ 1,519 (+695.29%)
Mutual labels:  atom, autocomplete

Snippets package

macOS Build Status Windows Build Status Dependency Status

Expand snippets matching the current prefix with tab in Atom.

To add your own snippets, select the Atom > Snippets... menu option if you're using macOS, or the File > Snippets... menu option if you're using Windows, or the Edit > Snippets... menu option if you are using Linux.

Snippet Format

Snippets 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.

'.source.js':
  'console.log':
    'prefix': 'log'
    'body': 'console.log(${1:"crash"});$2'

The outermost keys are the selectors where these snippets should be active, prefixed with a period (.) (details below).

The next level of keys are the snippet names.

Under each snippet name is a prefix that should trigger the snippet and a body to insert when the snippet is triggered.

$ followed by a number are the tabs stops which can be cycled between by pressing tab once a snippet has been triggered.

The above example adds a log snippet to JavaScript files that would expand to.

console.log("crash");

The string "crash" would be initially selected and pressing tab again would place the cursor after the ;

Optional parameters

These parameters are meant to provide extra information about your snippet to autocomplete-plus.

  • leftLabel will add text to the left part of the autocomplete results box.
  • leftLabelHTML will overwrite what's in leftLabel and allow you to use a bit of CSS such as color.
  • 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.
  • description will add text to a description box under the autocomplete results list.
  • descriptionMoreURL URL to the documentation of the snippet.

autocomplete-description

Example:

'.source.js':
  'console.log':
    'prefix': 'log'
    'body': 'console.log(${1:"crash"});$2'
    'description': 'Output data to the console'
    'rightLabelHTML': '<span style="color:#ff0">JS</span>'

Determining the correct scope for a snippet

The 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 => .text.html.basic). You can find out the correct scope by opening the Settings (cmd-, on macOS) and selecting the corresponding Language [xxx] package, e.g. for Language Html:

Screenshot of Language Html settings

If 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 (cmd-shift-p), 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.

Snippet syntax

This package supports a subset of the features of TextMate snippets, documented here.

The following features are not yet supported:

  • Variables
  • Interpolated shell code
  • Conditional insertions in transformations

Multi-line Snippet Body

You can also use multi-line syntax using """ for larger templates:

'.source.js':
  'if, else if, else':
    'prefix': 'ieie'
    'body': """
      if (${1:true}) {
        $2
      } else if (${3:false}) {
        $4
      } else {
        $5
      }
    """

Escaping Characters

Including 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:

'.source.js':
  'function':
    'prefix': 'funct'
    'body': """
      ${1:function () {
        statements;
      \\}
      this line is also included in the snippet tab;
      }
      """

Multiple snippets for the same scope

Snippets for the same scope must be placed within the same key. See this section of the Atom Flight Manual for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].