artimys
4/14/2017 - 5:31 PM

Create Snippet (erb tag)

How to Create Snippet (erb tag)

1) Tools > New Snippet (rails_erb.sublime-snippet)
    - Windows: 
      C:\Users\arturo\AppData\Roaming\Sublime Text 2\Packages\User
    - Mac:
      \Users\arturosimon\Library\Application Support\Sublime Text 2\Packages\User
        
2) Preferences > Key Bindings - Users
    - Paste my key_bindings (hotkeys for snippets, etc.)
# Preferences > Key Bindings - Users

# Windows
[
  {
    "keys": ["shift+alt+."],
    "command": "insert_snippet",
    "args": {"name": "Packages/User/rails_erb.sublime-snippet"}
  }
]

# Mac
[
  {
    "keys": ["shift+command+."],
    "command": "insert_snippet",
    "args": {"name": "Packages/User/rails_erb.sublime-snippet"}
  }
]
# Tools > New Snippet

<snippet>
	<content>
		<![CDATA[
			<%= ${0:Whoa} %>
		]]>
	</content>
	
	<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
	<tabTrigger>erb</tabTrigger>
	<!-- Optional: Set a scope to limit where the snippet will trigger -->
	<!-- <scope>source.python</scope> -->
</snippet>