How to edit the syntax highlighting file for yaml?

Skip to first unread message


Nov 4, 2019, 10:01:16 PM11/4/19
to niceeditor
I edit yaml files regularly and I don't like the syntax highlighting in ne, as the key names are in bright white while the values are in green.  The other way around would make more sense.

I tried editing yaml.jsf, but nothing I tried seem to make a difference.  I can't make any sense of what's in it.  Does anybody know how to swap the colours around?  Thanks.

Nov 5, 2019, 9:01:42 AM11/5/19
to niceeditor
There's quite a lot to unpack here. The yaml.jsf are all at the top of the file; "white" isn't listed anywhere, and the only mention of "green" is for comments. My guess is that you have a terminal palette that's something other than black text on a white background. In that case, your emulator is mapping the specified colors to something else in its palette. You'll have to work out what that mapping is, but at the very lease we can say it maps cyan (i.e. "Constant") to green.

As for editing .jsf files: There are two location ne will look for .jsf files. First it'll look in your ~/.ne/syntax directory, and if it finds ~/.ne/syntax/yaml.jsf, it will use that. If not, it will look in either /usr/share/ne/syntax or /usr/local/share/ne/syntax (depends on options your ne was built with) and use the appropriate .jsf file it finds there.

However, just changing the file isn't enough; ne only loads any given .jsf file once and caches it in memory, because they don't normally change. If you are actively working on a .jsf file and you want to see the results, you need to fire up another instance of ne to get your changes loaded into it.

When I'm doing work on a .jsf, I have two terminals open: one with an ne that has my ~/.ne/syntax/<whatever>.jsf open for editing, and the other for starting another ne with a sample document to test the .jsf I've been working on. Any time I make changes to the .jsf, it's necessary to quit the sample ne and start it back up again to be sure to load the latest version of my .jsf.

Once I'm done, I usually throw it away because it's rubbish. But on the off chance I actually did something right, I'll leave it in my ~/.ne/syntax directory if it's only of interest to me, or I'll move it to /usr/share/ne/syntax. If it's really good, I'll consider making a pull request to ne's github repo and/or the project from which ne gets most of its .jsf files.

I hope that helps.

Nov 6, 2019, 10:34:37 AM11/6/19
to niceeditor
In order to see what particular color definitions look like on your terminal, I have created a little perl program that generates 8-, 16-, and 256-color .jsf files and corresponding sample text files. You can get a copy from github as There's no configuration necessary. Just run it and it will generate six files:




Nov 12, 2019, 1:26:46 PM11/12/19
to niceeditor
It turns out the github gist I linked to the other day  -- with a perl script to demonstrate .jsf colors -- had a few problems.

I've updated that gist to actually work, in case anybody wants to see just how many colors your terminal can support. It's kind of ridiculously many.


Dec 11, 2019, 12:01:42 AM12/11/19
to niceeditor
Thanks.  I modified it so that the names are not as prominent as the values.  This what I came up with in the end:

Reply all
Reply to author
0 new messages