How to override a default snippet?


I can not seem to override a built-in snippet.

Using Rails, I want “scope + TAB” to expand to

"scope :named, ->(argument) { where(attribute: argument) }"

but I get the default

scope :name, joins(:table).where('.field = ?', 'value')

I debugged the scopes at cursor where I want the snippet to expand and it’s “source.ruby.rails, meta.rails.model”

So I added in snippets.cson

  'scope definition':
    'prefix': 'scope'
    'body': """
      scope :named, ->(argument) { where(attribute: argument) }

But this does not work, “scope + TAB” still gives the default expansion.
Curiously, if I change 'prefix': 'scope' to 'prefix': 'scx', the snippet “scx + TAB” works.

I have tried restarting Atom, no luck. What am I missing?

Remove or disable some default snippets

It looks like the scope snippet is under .meta.rails.model. I suspect the built-in scope snippet’s selector is more specific. Have you tried using .meta.rails.model as your selector?


First tried on home windows with no luck, but then on work mac it worked.
The final override is:

  'scope definition':
    'prefix': 'scope'
    'body': """
      scope :named, ->(argument) { where(attribute: argument) }

Thanks, @leedohm


Can specific snippets be disabled entirely? I’m writing a different snippet, and they are conflicting.

(In HTML) when AS is entered into the field ca-${1:x}, it triggers <canvas id="canvas" width="300" height="300"></canvas>, whereas I need it to remain ca-as and move to the next field on tab.

Alternatively, is there a way to prevent snippets from firing within other snippets?


Atom doesn’t support snippets being activated within other snippets. See:

There is also an open Issue around snippets being activated immediately after punctuation:

From what you’ve included, it sounds like there is some unintended consequence that might be causing the problem you’re experiencing.


These seem to be similar to the issue I’m having, but I’m hoping there is a solution - I could find no solutions in the articles referenced above; This is being triggered by a built-in autocomplete that I don’t want or need, and it’s requiring an otherwise simple string to have an overly-complex workaround.


The snippets package doesn’t have a method by which you can disable or delete a snippet, no.