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.
Sign up for my mailing list and I'll send you a FREE sample from my course - Web Development with Go. The sample includes 19 screencasts and the first few chapters from the book.
You will also receive emails from me about Go coding techniques, upcoming courses (including FREE ones), and course discounts.
Jon Calhoun is a full stack web developer who teaches about Go, web development, algorithms, and anything programming. If you haven't already, you should totally check out his Go courses.
Previously, Jon worked at several statups including co-founding EasyPost, a shipping API used by several fortune 500 companies. Prior to that Jon worked at Google, competed at world finals in programming competitions, and has been programming since he was a child.
Related articles
Spread the word
Did you find this page helpful? Let others know about it!
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.
©2024 Jonathan Calhoun. All rights reserved.