7

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?

taylor swift
  • 442
  • 1
  • 3
  • 17
  • 1
    Maybe this can help. Atleast guide you in the right direction: http://askubuntu.com/questions/295559/how-to-add-a-new-language-definition-for-syntax-highlighting-in-gedit – Parto Nov 09 '16 at 13:46
  • @Parto the problem is i do not know enough about the syntax space of the Swift language to write my own highlighter… – taylor swift Nov 09 '16 at 20:51
  • Alternately, you could install an editor on Ubuntu, such as [Atom](https://atom.io/), which already has addon packages (e.g. `language-swift`, `swift-debugger`, `autocomplete-swift`, `swift-autocomplete-snippets`, `language-swift3`, ...) which support the Swift. – marc-medley Nov 16 '16 at 01:56

1 Answers1

5

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:

https://git.gnome.org/browse/gtksourceview/plain/data/language-specs/swift.lang

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

~/.local/share/gtksourceview-3.0/language-specs/

Then gedit will highlight Swift code for you.

Adam Dingle
  • 340
  • 4
  • 7
  • @taylor-swift , does this post not answer your question? It works at least for me, I think you could consider accepting it – Antek Oct 09 '18 at 08:18