Syntax highlighting for schematic and pcb files


#1

One beauty of Kicad is that the schematic, pcb and library files are plaint text. For this reason I find myself more and more frequently using a text editor to manipulate these files.

While the files are easy to parse by the eye, adding some highlighting to the text could help navigating the files, e.g. like most editors highlight C code or other programming languages.

I’m currently using Kate as my main editor which uses XML files for highlight definitions and looking at sample files and the Kate documentation on this topic immediately gives me a headache …

Has anybody done some work on a highlight definition file for Kicad Schematic and/or PCB files?

I’d even go so far and ditch Kate for an editor with simpler highlighting definition syntax.


#2

For the PCB and footprint files, the ones that are s-expressions, if you set the language to some sort of Lisp (Common Lisp, Scheme, Racket) you should be able to get decent syntax highlighting.

For Vim I just have:

au BufNewFile,BufRead *.kicad_mod,*.kicad_pcb set filetype=lisp

#3

Notepad++ allows this to be done fairly easily, see https://github.com/Edditoria/markdown_npp for an example


#4

Clojure is another s-expression LISP based language - and there is good, built-in support for it in Atom. ( https://atom.io). It works well out of the box – If you wanted a specific tweak I guess the grammar definition could be relatively easily modified to support specific Kicad options.


#5

Thank you all for the replies.

All LISP-based highlightings kind of work, but Kate’s highlighting for Clojure definitely does a good job out of the box.

I will take a look at Atom, it looks promising. The caveat is that there are only 64 bit linux binaries available, but maybe this is finally a good reason to brush up my production system with a 64 bit Linux :wink: