Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Ability to import multiple snippets.cson files #124

Open
@izuzak

Description

@izuzak

From @morseldesign on March 29, 2015 19:51

Feature

Ability to do an @import or require() syntax for breaking up snippets into multiple files. For example @import "/snippets/documentation-snippets.cson" or require('snippets/javascript-snippets.cson').

Why

After awhile, snippet files can become pretty overwhelming to manage. Having multiple files would not only help with organization, but make it a little easier to manage changes to certain snippets.

Example

Given a file called snippets/javascript-snippets.cson with contents like:

###
  JavaScript Snippets
###
'.source.js':
  'Console log':
    'prefix': 'log'
    'body': "console.log($1);"

We could import it lnto ~/.atom/snippets.cson like:

# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
# '.source.coffee':
#   'Console log':
#     'prefix': 'log'
#     'body': "console.log $1'"
#

# Syntax #1
@import "snippets/javascript-snippets.cson";

# Syntax #2
require('snippets/javascript-snippets.cson');

Copied from original issue: atom/atom#6155

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions