Override default fragments in Atom

I am trying to override the default snippets in Atom because I want to change the default snapshot of the script

<script charset="utf-8"></script> 

to

 <script src=""></script> 

I put the following in snippets.cson.

 '.text.html': 'Comment': 'prefix': 'com' 'body': '<!-- $1-->' 'Script': 'prefix': 'script' 'body': '<script src="$1"></script>' 

My compiler is working fine. But the script leads to the default fragment, and not to my new one.

+6
source share
2 answers
  • Add a fragment that overwrites an existing fragment
  • Log out Atom
  • Run atom
  • Run the newly added fragment, and the original fragment will call
  • Open the file ~ / .atom / snippets.cson and save the file (no changes are required)
  • Run the snippet again and it will use the customized version

Apparently this is a mistake right now.

via https://github.com/atom/atom/issues/2695

+3
source

Starting with version 1.19.5, I can redefine fragments by default using the traditional procedure for creating fragments, which is written in coffeescript. For example, rewriting my require method looks something like this.,.

  '.source.[*yourlanguage*]': 'Require': 'prefix': 'r' 'body': "require '$1' " 

In details

  • Go to the "snippets" in the file’s drop-down menu.

  • Follow the instructions or continue with me.

  • Copy and paste the code above below. Replace your language with the language in which you write the code.

  • Open a new file, enter the character following the "prefix" :, click the tab.

  • This should give you enough information to contextually determine how to overwrite and write the original fragments.

0
source

Source: https://habr.com/ru/post/974380/


All Articles