Edit G-Code with code folding

More
11 Mar 2016 06:10 - 11 Mar 2016 06:11 #71379 by FernV
Hi all,

Since gedit does not support folding, I searched a g-code editor that could do it but did not find anything interesting.

However I found that KDE Kate supports folding, snippets, etc. So I wrote syntax highlighting and snippets specific to LinuxCNC and made them available for download at github.com/FernV/Gcode-highlight-for-Kate

Everything you write has a style : g code, m code, o code, params (local and global), operators, etc. Colors are easily modified in Settings->Configure Kate and you can also easily edit snippets.

Installation instructions is in README.md
Screenshots are available here : forum.linuxcnc.org/forum/40-subroutines-...cgui?start=300#70985

Best regards
Fernand
Last edit: 11 Mar 2016 06:11 by FernV.
The following user(s) said Thank You: BigJohnT, cncnoob1979

Please Log in or Create an account to join the conversation.

More
11 Mar 2016 12:08 - 11 Mar 2016 13:52 #71390 by BigJohnT
Thanks for this. You might want to mention in your instructions to run Kate once to create the hidden directories then copy the files.

I'm confused, do I need to add katepart/syntax and ktesteditor_snippets/data to .kde/share?

Following on I don't have Settings > Configure Kate... in the menu. I did find Tools > Snippets... and checked off G-Code.

I don't see anything about open save modes. I'm using Kate Part Version 3.7 using KDE development platform 4.14.2.

Looks like the Kate for LinuxMint is a stripped down version of the Windoze version.

I just installed Kate for Windoze and it seems to be the one you based your instructions on as it has all the things on the menu.

And because I installed it on Windoze XP the directory structure is different. You might mention what version of Windoze your instructions are for.

I just installed on Windoze 7 and still can't find the directories you have in your instructions nor figure out where I might put the plugin.

JT
Last edit: 11 Mar 2016 13:52 by BigJohnT.

Please Log in or Create an account to join the conversation.

More
11 Mar 2016 16:04 - 11 Mar 2016 16:24 #71417 by FernV
Replied by FernV on topic Edit G-Code with code folding
Hi John,

You are right. I should have mentionned that the directories are created by Kate when you first create a snippet Repository. If not you can create them yourself and it should work.

Kate5 for Windows I installed on Windows 10 is an alpha version and was downloaded at www.anvianet.fi/sars/

I still have 1 XP computer on the floor and I just installed Kate5 on it.

I opened Kate, selected "Settings->Configure Kate...", selected "Plugins" and checked "View code snippets tools" (or the like). Click "Apply" then "OK". The tab for the snippets is on the right. Right-click on it and select "Left Sidebar" then click on it to open the sidebar.

Clicked "Add Repository" button, gave it a simple name and clicked "OK". The directory is the one I mentionned : C:\Users\%name%\AppData\Local\ktexteditor_snippets\data

Closed Kate, downloaded a zip of Gcode-highlight-for-Kate and extracted gcodeHL.xml to
C:\Users\%name%\AppData\Local\katepart5\syntax (after I created it)
then extracted G-Code-snippets.xml to
C:\Users\%name%\AppData\Local\ktexteditor_snippets\data (already created)
and I also extracted *.ngc to desktop.

Restarted Kate, selected "Tools->Highlighting->Other" and found "G-Code" in the list.

Then I selected "Settings->Configure Kate...", selected "Open/Save" then the tab "Modes & Filetypes", clicked on "New"

Then I filled the blanks like this :
Name = G-Code
Section = Other (or leave blank)
Highlighting = Other/G-Code (in the combo)
Indentation Mode = Use Default (or Normal)
File extensions = *.ngc (or a list separated by ; )
MIME types = text/ngc
Priority = 0 (or higher if other Modes use the same File extensions)

Clicked "Apply" (better do it cause this version may crash and you have to start over) then "OK"

Then opened the demo files.
(Re-open "Configure Kate..." to change Font size)
The steps are the same as with Windows 10

For Linux, I use Wheezy and Kate version is 3.8.4 and the steps are very similar.
It is possible that for older versions the Configure Kate option is under the Help menu ?

NOTE : Kate(MDI) and KWrite(SDI) are both based on katepart and the highlighting will work on both but KWrite does not support plugins. However, changing settings for KWrite will erase some settings for Kate. Configure Kate only.

Maybe I should create a short video on doing this, what do you think ?

Best regards
Fernand
Last edit: 11 Mar 2016 16:24 by FernV.

Please Log in or Create an account to join the conversation.

More
11 Mar 2016 16:19 #71420 by LAIR82
Can this be implemented in the INI as the G-code editor for programs?

Rick

Please Log in or Create an account to join the conversation.

More
11 Mar 2016 16:28 #71421 by FernV
Replied by FernV on topic Edit G-Code with code folding
Hi Rick,

There are maybe more than 100 syntax highlighting mode in Kate and maybe the one you need is there. If not, could you be more specific on your needs ?

Regards
Fernand

Please Log in or Create an account to join the conversation.

More
11 Mar 2016 16:32 #71423 by LAIR82
What I was wondering was, in the INI you can specify "EDITOR = gedit", could I put "EDITOR = kate" and it would work when editing programs at the machine.

Rick

Please Log in or Create an account to join the conversation.

More
11 Mar 2016 16:34 #71426 by FernV
Replied by FernV on topic Edit G-Code with code folding
That is what I did

Fern

Please Log in or Create an account to join the conversation.

More
11 Mar 2016 16:37 #71427 by LAIR82
Aaaaahhh,

I was thinking that this was being used offline for program editing.

Looks like I have some updating to then on the machines.

Looks Good, Nice work!!!

Rick

Please Log in or Create an account to join the conversation.

More
02 Apr 2016 15:58 - 02 Apr 2016 16:00 #72572 by cncnoob1979
Im on Linux mint 17.3 and after installing kate I also had to install the packages to get the "configure Kate" dialogue working. It would also crash on file/open.

EDIT: Package manager did not automatically install these:


sudo apt-get install kdelibs-bin kdelibs5-data kdelibs5-plugins
Last edit: 02 Apr 2016 16:00 by cncnoob1979.

Please Log in or Create an account to join the conversation.

Time to create page: 0.094 seconds
Powered by Kunena Forum