Search code examples
djangosublimetext3jinja2

How to get sublime text 3 editor to auto-complete the "{% " with " %}" to save time?


I have started developing django apps with Sublime Text 3, and find the "{% %}" brackets in jinja logic to be very tedious to type, so i wonder is there a way to auto-complete the "{% " bracket with " %}" to save some time?


Solution

  • You could try creating a snippet for speeding things up.

    Click Tools -> Developer -> New Snippet

    <snippet>
        <content><![CDATA[
    {% ${1:} %}
    ]]></content>
        <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
        <tabTrigger>insert-a-trigger-to-activate-on-tab</tabTrigger>
        <!-- Optional: Set a scope to limit where the snippet will trigger -->
        <!-- <scope>source.python</scope> -->
    </snippet>
    

    or, someone else has made a bunch of these here: https://github.com/squ1b3r/Djaneiro