Creating your own Snippet on Atom

2

I'm trying to create my own snippets in the atom, but none of them have any workings.

I tried:

'*':
  'Controller text'
    'prefix': 'lco'
    'body': 'my name is $1'

But when typing lco and pressing TAB, it does nothing, I also tried for php

'.source.php':
  'Controller text'
    'prefix': 'lco'
    'body': 'my name is $1'

and for html

'.source.html':
  'Controller text'
    'prefix': 'lco'
    'body': 'my name is $1'

or

'.text.html':
  'Controller text'
    'prefix': 'lco'
    'body': 'my name is $1'

In none of the ways I create my personal snippets does Atom create the snippets. In the above cases are examples to simplify what I want to do.

What is the right way to work with snippets on Atom? I followed examples from the documentation and can not get the results you expect.

Att. Thiago Prado

    
asked by anonymous 06.08.2014 / 02:15

2 answers

4

A : is missing after the snippet name:

'.source.php':
  'Controller text':  # Aqui.
    'prefix': 'lco'
    'body': 'my name is $1'
    
07.08.2014 / 03:49
2

In this new version it just was not working.

To work, I had to do the following (for any language) without needing variables.

'*':
  'Snippet Name':
    'prefix': 'html'
    'body': """
      <!DOCTYPE HTML>
      <html lang="pt-br">
          <head>
          $1
          <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
          <link rel="icon" href="favicon.ico" type="image/x-icon" />
          <link rel="stylesheet" type="text/css" href="css/estilo.css">
          <script type="text/javascript" src="js/arquivoJS.js"></script>
          <title></title>
          </head>
          <body>
            <h1>CONTEUDO</h1>
          </body>
      </html>
    """
    
27.05.2015 / 18:51