How to syntax highlight different assembly languages in Gedit?

999 Views Asked by At

By default, text editors using GtkSourceView (such as Gedit and Mousepad) don't highlight .asm files. The solution by Drew Noakes is to download a GtkSourceView language definition file for x86 assembly language into .local/share/gtksourceview-3.0/language-specs/. I know how to make a language definition file per GNOME.org's GtkSourceView documentation.

However, I routinely work with multiple instruction sets, each of which needs different highlighting rules:

  • MOS 6502 assembly (for NES, Commodore 64, Apple II, Atari 8-bit, etc.)
  • Sharp SM83 assembly (for Game Boy)
  • Zilog Z80 assembly (for MSX, ZX Spectrum, Game Gear, etc.)
  • ARM assembly (for Game Boy Advance, etc.)

All of them may use .s or .asm as a file name suffix, so the <metadata><property name="globs">*.s</property></metadata> appears inadequate to distinguish them.

Is there a good way to indicate the instruction set of an assembly language file to a GtkSourceView editor? In particular, is there a better way than locally defining an Internet media type for each ISA using shared-mime-info, using <magic>, and ensuring that all collaborators also have the same locally defined Internet media type?

0

There are 0 best solutions below