Adding a Language to gedit

When I do development, my favorite editor is gedit.  Sure, I know there are other IDEs out there with lots more bells and whistles, but I like to keep it simple.  I’ve recently come back to the Ionic Framework with a new project I’m working on.  The new version of Ionic uses “TypeScript,” a language that compiles to JavaScript.  When I went to open TypeScript files using gedit, I was bummed that there was no syntax highlighting!  Just plain gray text in the entire file.

So, I looked into how I could add text highlighting for a currently unsupported language in gedit.  The files that define the syntax highlighting for gedit are located (for me at least) in:

/usr/share/gtksourceview-3.0/language-specs/

The language files have the extension *.lang. After trying to create a TypeScript language file myself with minimal success, I finally managed to get the right Google search of “gedit lang file for typescript” and found that someone had already created one. It’s on github here.

I then just downloaded this file, placed it in the directory above (using sudo cp in the terminal to do so), restarted gedit, and it worked!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: