Atom Editor: multiple snippets

后端 未结 6 1189
孤街浪徒
孤街浪徒 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 03:56

    The configuration file format is called CSON, CoffeeScript Object Notation. Like JSON (JavaScript Object Notation) it is a text format for describing simple objects. Because of which, when you specify a key twice, like .source.js in your example, the second instance overwrites the first. If you simply have one .source.js everything will work fine:

    '.source.js':
      'Normal Comment Block':
        'prefix': 'cmm'
        'body': """
          //**********************************************************************************
          // $1
          //**********************************************************************************
          $0
        """
      'Dashed Comment Block':
        'prefix': 'c--'
        'body': """
          //----------------------------------------------------------------------------------
          // $1
          //----------------------------------------------------------------------------------
          $0
        """
    

    Additionally, I took the liberty of adding tab stops to your snippets so that when you expand the snippet, your cursor should land first inside the comment. You can enter your comment and then press TAB to exit out and continue on.

提交回复
热议问题