Programs » Sublime Text

Wrap Selection in a Tag, PHP, Snippet

1. Go to Tools -> New Snippet…

2. Change the content:

  <content><![CDATA[<?php $SELECTION$1 ?>]]></content>
  <scope>text.html - source.php</scope>
  <scope>text.html - source.php</scope>

3. Save to a file with any name

4. Go to Preferences -> Key Bindings – User

5. Add the shortcut

{"keys": ["ctrl+shift+e"], "command": "insert_snippet","args":{"name": "Packages/User/php_wrap.sublime-snippet"}},

6. Test it: type “word”, select it and press the shortcut.

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>