In Sublime Text 2 when inserting an html script tag using auto complete the cursor jumps to the end of the tag.
<script type="text/javascript"></script>*CURSOR HERE*
How can i modify the auto completion in Sublime so when I tab-complete an html script tag a src-attribute is added to the tag and the cursor jumps to the quotes of the src-attribute?
I found the following line in the Sublime HTML.sublime-completions file:
{ "trigger": "script", "contents": "<script type=\"${1:text/javascript}\">$0</script>" }
I tried modifying it to the following:
{ "trigger": "script", "contents": "<script type=\"${1:text/javascript}\" src=\"$1\">$0</script>" }
For this I referenced the html link tag in the file:
{ "trigger": "link", "contents": "<link rel=\"stylesheet\" type=\"text/css\" href=\"$1\">" }
I tried installing another package called HTMLAttributes, but this didn't add the functionality i want.
I also tried modifying the script tag, i removed the type, but Sublime can still auto complete it. Am I modifying it wrong? Or in the wrong file?
Thanks for any help.
Please try to add the following code in html_completions.py located in the packages folder.
("script\tTag", "script type=\"${2:text/javascript}\" src=\"$1\">$0</script>" ),
More information: http://docs.sublimetext.info/en/latest/reference/completions.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With