Страница 1 из 1

Highlight Gcode in Gedit

Добавлено: 18 авг 2010, 14:09
Nick
Despite it's simplicity Gedit (it's default "Notepad" for Gnome for Linux) has a lot of useful functions. One of them is syntax highlighting for different programing languages, scripts, htlm, xml, etc. By default Gedit supports about 100 different languages but unfortunately Gcode not in that list. So I've decided to write Gcode syntax highlighting for Gedit.

Here's how it's look like using "Oblivion" color scheme:
0079 gedit gcode hightlight.png (22033 просмотра) <a class='original' href='./download/file.php?id=619&mode=view' target=_blank>Загрузить оригинал (161.19 КБ)</a>

How to get your Gedit highlight the Gcode
and make your own Gcode viewer

  1. Download this file:
    gcode.lang
    (7.31 КБ) 2481 скачивание
  2. Save it into "/usr/share/gtksourceview-2.0/language-specs/". Restart Gedit if it needed.
  3. If you want to st up color scheme same to my do the following Edit->Preferences->Fonts & Colors and select "Oblivion".
PS Just before I've finished my gcdoe.lang I've found almost the same one at wiki.linuxcnc.org. But there some major differences.
My version differentiates different G and M codes for example coolant M codes M7, M8 and M9 are drawn in blue, start / stop M codes are on red background. Also some spindle and feed parameters which can appear inside the line with G code are drawn in green so they become more visible.


Hope there wont be any bugs/mistakes but if you've found one do not hesitate to report it ;) .

Re: Highlight Gcode in Gedit

Добавлено: 19 июн 2012, 20:13
James628
Hi Nick,


I installed the Gedit G-code highlight file, it's much better than I had previously, but still there are some small issues. Especially with the named parameters.
What can be the problem?

Изображение

Thanks for your support in advance.

James

Re: Highlight Gcode in Gedit

Добавлено: 19 июн 2012, 21:40
Nick
hmmmm... probably it's because "-" not in the variable pattern

line 68. <match>#([0-9]+|<[a-zA-Z_0-9\-]+>)</match>

Fixed version is in the header.

Re: Highlight Gcode in Gedit

Добавлено: 19 июн 2012, 22:35
James628
Hi Nick,

Thanks a lot!!
That was very quick.

Now only one item left: comments after semicolon are too colorful yet ;)
As in the screenshot above

James

Re: Highlight Gcode in Gedit

Добавлено: 19 июн 2012, 22:58
Nick
Do I get it right - everything after semicolon till the end of line is a comment?

Re: Highlight Gcode in Gedit

Добавлено: 20 июн 2012, 07:01
James628

Re: Highlight Gcode in Gedit

Добавлено: 20 июн 2012, 10:48
Nick
Fixed. See updated file in the header.

PS Thanks for the bug report! :)

Re: Highlight Gcode in Gedit

Добавлено: 20 июн 2012, 11:55
James628
Hi Nick,

Thanks for the fix.
I am wondering how much excellent information can be found on this forum.. very good job...

Re: Highlight Gcode in Gedit

Добавлено: 20 июн 2012, 12:33
Nick
James628 писал(а):I am wondering how much excellent information can be found on this forum.. very good job...
Not so much in English, there's much more info in Russian, but it is much more difficult to find something in that mess :freak:

Re: Highlight Gcode in Gedit

Добавлено: 20 июн 2012, 13:03
James628
Sure, mainly I meant here the Russian language content. Google translation is quite usable.
Although I learnt almost ten years Russian language, but I hardly can remember anything.

Re: Highlight Gcode in Gedit

Добавлено: 11 май 2016, 14:22
anmol77
Some spindle and feed parameters which can appear inside the line with G code are drawn in green so they become more visible.