LIGGGHTS Syntax Highlighting

Philippe's picture
Submitted by Philippe on Wed, 01/18/2012 - 14:38

Syntax highlighting for the Gnome text editor gedit is now available. It can be found here.

Feedback is appreciated, so give it a try and tell us your opinions and experiences.

richti83's picture

richti83 | Thu, 01/19/2012 - 08:54

this is really cool !
greez, Christian

I'm not an associate of DCS GmbH and not a core developer of LIGGGHTS®
ResearchGate | Contact

Silias | Wed, 03/28/2012 - 11:07

Hy everybody,

I copied the file into the folder /usr/share/gtksourceview-2.0/language-specs, restarted my gedit sessions and selected the LIGGGHTS Highlighting-View but all I can see are black letters...?

I work on a suse linux instead of an ubuntu system, could that be the reason?

Regards,
Sebastian

dbreton's picture

dbreton | Thu, 01/19/2012 - 15:27

I have the following lammps.nanorc file (modified from the awk.nanorc file) for those of you who use nano. To make it work, you'll need to add this line to the end of your ~/.nanorc file:

include "/home/dbreton/lammps.nanorc"

and then save the following code as the file lammps.nanorc in your home directory.


#########################################################
## lammps.nanorc -- an example for LAMMPS/LIGGGHTS input scripts.
## Valid colors are "green", "red", "blue", "white", "yellow", "cyan", "magenta" and
## "black", with the optional prefix "bright" for foreground colors.
## syntax highlighting rules applied in the order they are read in.
########################################################
## Apply this highlighting for files ending in .lmp -- edit as you see fit
syntax "lmp" "\.lmp$"
## variables with leading $
icolor green "\$[0-9A-Z_!@#$*?-]+"
## most keywords -- edit as you see fit
color red "\<(atom_style|atom_modify|boundary|newton|read_data)\>"
color red "\<(group|communicate|neighbor|neigh_modify|pair_style|pair_coeff)\>"
color red "\<(timestep|run|dump|compute|dump|thermo|thermo_modify)\>"
color red "\<(compute_modify|thermo_style|displace_atoms|mass)\>"
## some other keywords
color brightred "\<(region|write_restart|read_restart|create_box)\>"
color magenta "\<(property|units)\>"
## variable definitions
color brightgreen "\<(variable)\>"
## operators
color green "(\{|\}|\(|\)|\;|\]|\[|\\|<|>|!|=|&|\+|-|\*|%|/|\?:|\^|\|)"
## flow control
color brightyellow "\<(label|if|while|do|else|in|delete|exit)\>"
color brightyellow "\<(jump|break|continue|return)\>"
## I/O statements
color brightgreen "\<(print)\>"
color brightgreen "\<(shell)\>"
## fix and set
color brightmagenta "\<(fix|unfix|set)\>"
## String highlighting.
color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
## Comment highlighting
color brightblue "(^|[[:space:]])#.*$"
## Trailing whitespace -- not really necessary
color ,green "[[:space:]]+$"
## END ##########################################

good luck
DAN

Philippe's picture

Philippe | Mon, 01/23/2012 - 08:31

Thank you Dan, this may be very helpful to some users!

Philippe

maxxum | Wed, 07/10/2013 - 12:14

Hello. I tried to get this syntax highlighting to work. I use a RHEL6 server and I run KDE, but there is gedit installed. I asked the system admin to put the file in the correct place, and I see there are other .lang files there. Upon starting gedit, it shows LIGGGHTS as one of the options for syntax highlighting but it does not highlight. With this preference set, now whenever I start gedit from a command line, I get a bunch of errors in the console:
--------------------------
(gedit:17854): GtkSourceView-WARNING **: in file /usr/share/gtksourceview-2.0/language-specs/liggghts.lang on line 33: Expecting element match, got start

(gedit:17854): GtkSourceView-WARNING **: in file /usr/share/gtksourceview-2.0/language-specs/liggghts.lang on line 33: Element context failed to validate content

(gedit:17854): GtkSourceView-WARNING **: in file /usr/share/gtksourceview-2.0/language-specs/liggghts.lang on line 33: Expecting element include, got start

(gedit:17854): GtkSourceView-WARNING **: in file /usr/share/gtksourceview-2.0/language-specs/liggghts.lang on line 33: Element context failed to validate content

(gedit:17854): GtkSourceView-WARNING **: in file /usr/share/gtksourceview-2.0/language-specs/liggghts.lang on line 28: Invalid sequence in interleave

(gedit:17854): GtkSourceView-WARNING **: in file /usr/share/gtksourceview-2.0/language-specs/liggghts.lang on line 28: Element definitions failed to validate content

(gedit:17854): GtkSourceView-WARNING **: Failed to load '/usr/share/gtksourceview-2.0/language-specs/liggghts.lang': in file /usr/share/gtksourceview-2.0/language-specs/liggghts.lang on line 33: Invalid attribute class for element context
--------------------------------------------

maxxum | Thu, 07/11/2013 - 10:32

Following up on my previous error report, I was able to get it to work on a Ubuntu 13.04 virtual machine. So the problem is because of either Red Hat or KDE on my server.

pfalkingham | Tue, 09/26/2017 - 10:32

I've put together an extension for Visual Studio code that offers basic highlighting for *.liggghts files.

You can download it from here: https://1drv.ms/u/s!Am5GkbZS_98XraFHxgkES1DMDtZFqQ (I'll try and keep the link up for at least a month or so)

Then install manually through the extensions pane in Visual Studio Code.

If this is of use to people, I'm happy to continue development and publish it to the Visual Studio Code Extensions Market Place, which would make download and installation easier.