Sublime Forum

SetDjangoSyntax

#1

i made a quick and dirty little plugin that attempts to set the syntax of the open buffer to “python django” when appropriate.

it is dependent on having already installed the Djaneiro package.

the way that SetDjangoSyntax works is probably pretty dumb, but in practice it seems to work fairly well on my box. please fork the repo and improve it if you can. at present, all it does is search the text of an open buffer whose filename ends in ‘.py’ for a string that equals “from django”. if it finds that string it sets the syntax to “python django”.

install SetDjangoSyntax via package control.

or you can download it directly (and/or view source) here.

0 Likes

#2

lately i noticed that every python file was being set to Python Django syntax. I think but am not sure that this is due to a change in Djaneiro.

in any case, i went about trying to fix it and found a bug in SetDjangoSyntax that i just pushed a fix for. the latest version in the repo (and i assume soon to push out to everyone via package control) tries to be smart about whether to change a file’s syntax to Python Django or just Python syntax.

please let me know if anyone is seeing issues with this version.

0 Likes