1
votes

I am creating some python files with extensions .pyt. Every thing is working fine except syntax highlighting.

My new .pyt files are not syntax highlighted as normal .py files do.

Ofcourse, I can change in

view>Highlight Mode> Script > python  

manually for every file, but there are around 1200 files and they keep growing. I really dont want to do this manually for each file for the the first opening.

Is there any way to apply default python syntax highlighting to my new .pyt files.

Any Help will be highly appriciated.

P.S. I have read how to do this for gedit 2.0 in many pages like page1, page2 and many more pages but couldn't find any good working processes for gedit 1.0.

1
Why must you use such an old version of gedit?wim
That I cant change @wim this is my office machine and have to live with it. :(Sravan K Ghantasala
Just a thought, my gedit puts the correct syntax highlighting if I have the shebang, no matter the extension of the file (i.e. put first line of file as #!/usr/bin/env python). But I am on gedit 3.8.3, I'm not sure if 1.0 would do the same but it's worth checkingwim
I ve put the right shebang but no use.. :(Sravan K Ghantasala

1 Answers

0
votes

Although you (the OP) wrote that you found pages that were meant for gedit 3, I'm going to suggest that you look at this question.

Basically, even if gedit 1.0 used an older version of gtksourceview, as long as you can find the python.lang file in your system and change it, you can probably make it work. After all, it must have some way of specifying on which files it's used.

For new (Gtksourceview 2.0) lang files, this is done by adding either the mimetypes or globs property within the language's tag. So when you find the python.lang file, look for the *.py extension, and see if you can add *.pyt there, as is detailed in the question I linked above.