Use a custom snippet over a builtin one?


#1

The normal snippet from typing div and the [tab] is

<div id="name">

</div>

I created one I would rather use, added it to snippets.cson

'.text.html':
  'Div':
   'prefix': 'div'
   'body': '<div${1: class="${2:row}"}>\n\t$3\n</div>'

However, when I type div and tab I always get the builtin one.


How to modify an existing snippet?
#2

Your scope is wrong. The scope for an html file is .text.html.basic

{
    ".text.html.basic": {
        "Div": {
            "prefix": "div",
            "body": "<div${1: class='${2:row}'}>\n\t$3\n</div>"
        }
    }
}

I’ve created a package that takes care of most annoyances while creating snippets. Thanks to you I finally found out why sometimes snippets wouldn’t activate x]


#3

Can someone please answer his question?


#4

To which question are you referring @Obsidian_Jackal? It appears that the question was answered months ago.


#5

The question of how to “Use a custom snippet over a builtin one?” from the title and it would have been nice if you linked to this answer:

Also since this is a duplicated thread, it should have been marked as such and closed, to avoid confusion and to get people the solutions they were looking for.


#6

Fixed your link for you. I hope you don’t mind.

Additionally, there is good documentation of how to do this now in the Atom book:

https://atom.io/docs/latest/using-atom-snippets#creating-your-own-snippets