Ubuntu – Swift syntax highlighting in gedit

geditsyntax highlighting

I do not see an option for Swift highlighting in the gedit language menu. How can I get gedit to highlight Swift code for me?

Best Answer

A language definition for Swift has recently been added to the git repository of GtkSourceView (the library that performs syntax highlighting in gedit). It hasn't made it into any GtkSourceView release yet, but you can download it here:


Place this file (swift.lang) in this directory, creating it if necessary:


Then gedit will highlight Swift code for you.