Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure Atom to autocomplete Django templates

I need to find a way/package to make Atom use autocomplete for Django projects, especially Django templates. I found this package in Atom's installer, but it doesn't include a shortcut for auto completion of this syntax {% %}, {{ }} which I need the most. Any help will be appreciated

like image 749
youta Avatar asked Mar 12 '23 04:03

youta


1 Answers

You could make your own snippets in Atom.

To do that go to Edit > Snippets

In the document that open's you can paste this bit:

'.html.django':
  'Example snippet':
    'prefix': '%%'
    'body': '{% $1 %}$2'

This example would expand to {% %}, placing your cursor inside. To trigger it you type %% and hit tab. A second tab would place the cursor after the closing bracket.

The .html.django part means this snippet is active only in documents that are marked as HTML (Django)

I don't see why you would need a snippet for {{ }} as Atom auto-close's the brackets.

For more information read this - http://flight-manual.atom.io/using-atom/sections/snippets/

like image 187
4140tm Avatar answered Mar 21 '23 02:03

4140tm