Syntax Highlighting for Gedit

Hi Elm Community! I’m a new user (and potential community member!) and I’m interested in finding a syntax highlighter for gedit, which is the default for any flavor of Ubuntu. I use vim every once in a while, but this would be my second preference. I’m well aware of the Sublime Text editor, and I’m not looking to install a new editor. Does anyone know of an editor, or is familiar enough with elm syntax highlighting that they could contribute? Thanks!

1 Like

I found the vim editor file on GitHub, so I’m going to take a shot at using the rules to translate into one for gedit. If I’m successful, I’d be happy to share on here with the larger community (I absolutely can’t move forward with any programming without the pretty colors, lol!)

2 Likes

I think you have to make a syntax highlighting definition file for GtkSourceView (Gedit uses GtkSourceView).

Notepadqq has syntax highlighting for Elm. it’s a Notepad++ -like editor for the Linux desktop.

Does Gedit have Haskell syntax highlighting? The syntax is close enough that you may be able to change a few keywords and get a satisfactory result (e.g. you’d have to change data to type, remove newtype and typeclasses, stuff like that.)

3 Likes

I don’t know if the one in micro is any use: https://github.com/zyedidia/micro/blob/master/runtime/syntax/elm.yaml

@brian that worked beautifully!

<anonymized>

I made the quick changes that you mentioned, but could we talk about some of the “typeclasses and stuff like that?” I’m not familiar so I can’t interpret what that means. If it’s easier, you can also PR to update the file, which is based on haskell, see <anonymized>

Thanks for all the speedy responses! This derivative might not be perfect, but it provides enough color so it’s fun to work on and I’m happy. I’ll wait to share the repo more broadly until I’ve gotten feedback from folks here about additional changes that are needed.

I’ve opened a PR with some small fixes. Hope they’re helpful :slight_smile:

1 Like

Oops sorry, I made a conflicting PR fixing only the keyword list using:

Once everything is clean, a PR could be made to gtksourceview repo:

An issue requesting that has been made a few months ago by the way:

@dmy we’ve merged the first, but your PR is also needed! If you want to rebase with master we can get those changes in. Thanks to you both!

1 Like

Sure. I rebased it on top of master.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.