Disabling Specific Snippets (autocompletions) in Atom

I run into this issue a lot so I wanted to document how I handle it for others who are experiencing the same issue.

Let’s imagine you install this new package in Atom like GitHub flavored Markdown and it enables a snippet that you don’t like. In my case it was the code snippet which expands into the triple tildes (```) used for code samples in a markdown file.

The first thing you want to do is figure out what source the snippet was introduced under. Most of the time you can figure that out based on the type of file you are in. Eg a go file is probably something like .source.go. That isn’t always the case, but it’s a good start.

Note: If that doesn’t work, as it doesn’t in this specific example, continue below and I’ll give more tips on finding the source.

You need to add a new snippet to your settings that disables the default one, so open up your settings.

Atom -> Settings (or cmd+, in mac) then click the Open Config Folder button.

This will likely open a new window with all your settings. You want to grab a file named snippets.cson. If yours has another extension you probably just need to use a different file format, but the general idea here is the same.

In this file we are going to add our custom snippet that disables the problem snippet. In my case it is code in markdown (.md files) so I tried this first:

'.source.md':
  'Disable code snippet':
    'prefix': 'code'
    'disabled': true

Next go back to a file where the problem snippet exists and try it out. Is it disabled? Great! You are done.

Not fixed? No problem. We just need to figure out the correct source for your snippet. This can typically be done by checking out the project on GitHub (or wherever the source is hosted) and looking for the snippets source file. In my case I found it here: https://github.com/atom/language-gfm/blob/master/snippets/gfm.cson

From here you can see that the source used by this plugin is .source.gfm. Head back to your snippets.cson file and update the source and test again.

You may have to repeat this process a few times until you find all the snippets you want to disable, but so far this is the most straightforward way I have found to disable snippets I dislike.

Learn Web Development with Go!

Sign up for my mailing list and I'll send you a FREE sample from my course - Web Development with Go. The sample includes three chapters from the book, and over 2.5 hours of screencasts.

You will also receive notifications when I release new articles, along with other freebies that I only share with my mailing list.

Avatar of Jon Calhoun
Written by
Jon Calhoun

Jon Calhoun is a full stack web developer who also teaches about Go, web development, algorithms, and anything programming related. He also consults for other companies who have development needs. (If you need some development work done, get in touch!)

Jon is a co-founder of EasyPost, a shipping API that many fortune 500 companies use to power their shipping infrastructure, and prior to founding EasyPost he worked at google as a software engineer.

Related articles

Spread the word

Did you find this page helpful? Let others know about it!

Vote on Hacker News

Sharing helps me continue to create both free and premium Go resources.

Want to discuss the article?

See something that is wrong, think this article could be improved, or just want to say thanks? I'd love to hear what you have to say!

You can reach me via email or via twitter.

Recent Articles Mini-Series Tags About Me Go Courses

©2018 Jonathan Calhoun. All rights reserved.