Atom Editor: multiple snippets

后端 未结 6 1179
孤街浪徒
孤街浪徒 2020-12-31 03:11

This is such a simple question but I can\'t find any documentation besides the readme.

How can I have multiple custom snippets in Atom Editior:

For example I

6条回答
  •  长发绾君心
    2020-12-31 04:02

    In addition to @Lee's explanation, here's an example if you wan't to setup multiple snippets organized by programming language:

    # HTML Snippets
    '.text.html':
      'HTML Comment':
        'prefix': ''
    
    # Sass Snippets
    '.source.scss':
      'Section Comment':
        'prefix': 'sc'
        'body': """
          /*=================================================
          $1
          =================================================== */
        """
      'Sub Section Comment':
        'prefix': 'ssc'
        'body': """
          /* $1
          =================================================== */
         """
    
    # JavaScript Snippets
    '.source.js':
      'jQuery - Bind Event':
        'prefix': 'bind'
        'body': """
           $( $1 ).on( '$2', '$3', function( $4 ) {
             $5
           });
        """
    

    On this example I included HTML, Sass and Javascript but you could include others like CSS, ...

    Hope this was usefull.

提交回复
热议问题