Page 1 of 1

external editor syntax highlighting

Posted: Tue Feb 28, 2012 3:28 pm
by dtoffo
I edit my configuration offline the routeros, so syntax highlighting would be a good help.
I use notepad++ and this morning made a "user defined lang" highlighting schema for .rsc files. I attach it (zipped).

Sure it's not perfect, but if anyone has better editor with routeros syntax, let me know!

d

Re: external editor syntax highlighting

Posted: Thu Mar 01, 2012 12:38 pm
by janisk
thanks for the highlighting, hopefully a lot of people will find it useful, also, maybe even some could add to your initial submission to improve it.

Re: external editor syntax highlighting

Posted: Wed Mar 07, 2012 1:42 am
by thegink
I use Textpad for the same thing - I've attached the syntax definition file I wrote for .rsc files.

t

Re: external editor syntax highlighting

Posted: Mon Mar 12, 2012 8:34 pm
by gsloop
@dtoffo

Cool! Thanks!

-Greg

Re: external editor syntax highlighting

Posted: Sat Mar 24, 2012 2:24 am
by senzatempo
thanks ..

why not put your ros.xml on notepad++ wiki

SENZATEMPO

Re: external editor syntax highlighting

Posted: Mon Mar 26, 2012 7:07 pm
by dtoffo
thanks ..

why not put your ros.xml on notepad++ wiki

SENZATEMPO
I didn't find where to put it... can you tell me where or put it there yourself?

d

Re: external editor syntax highlighting

Posted: Thu Apr 26, 2012 8:51 pm
by skot
Thanks dtoffo for sharing! I took me a bit to figure out how to add it to Notepad++ amongst all the menus. In case anyone wants to know: Click View > User-Defined Dialogue > click Import button

Re: external editor syntax highlighting

Posted: Mon May 28, 2012 6:17 pm
by angboontiong
Hi all...

may i know how to use this?

thanks.

Re: external editor syntax highlighting

Posted: Thu May 31, 2012 5:37 am
by skot
Hi all...

may i know how to use this?

thanks.
1. Download Notepad++: http://www.notepadplusplus.org
2. Install Notepad++
3. Download file above: http://forum.mikrotik.com/viewtopic.php ... 61#p305377
4. Open Notepad++, and click View > User-Defined Dialogue > click Import button. Import the xml file you just downloaded.
5. Open a .rsc script, and syntax highlighting will be visible.

Re: external editor syntax highlighting

Posted: Sat Jun 02, 2012 5:59 pm
by angboontiong
Hi all...

may i know how to use this?

thanks.
1. Download Notepad++: http://www.notepadplusplus.org
2. Install Notepad++
3. Download file above: http://forum.mikrotik.com/viewtopic.php ... 61#p305377
4. Open Notepad++, and click View > User-Defined Dialogue > click Import button. Import the xml file you just downloaded.
5. Open a .rsc script, and syntax highlighting will be visible.
Hi....
appreciated it and thanks a lot...

thanks...

Re: external editor syntax highlighting

Posted: Tue Jul 17, 2012 5:33 pm
by omega-00
I edit my configuration offline the routeros, so syntax highlighting would be a good help.
I use notepad++ and this morning made a "user defined lang" highlighting schema for .rsc files. I attach it (zipped).

Sure it's not perfect, but if anyone has better editor with routeros syntax, let me know!

d
I've made some improvements to the colour scheme (matching what's in winbox) and added a bunch more keywords; do you mind if I upload a copy of my modified version here and host another one on my website?

Re: external editor syntax highlighting

Posted: Wed Jul 18, 2012 12:43 pm
by dtoffo
Any update is always appreciated.

Post it for us and put where you want: there's no copyright nor any other restriction.
just I think it will be good to update this thread for anyone searching it on mikrotik forum

thanks

d

Re: external editor syntax highlighting

Posted: Wed Jul 18, 2012 3:04 pm
by omega-00
Here you go!
RouterOS-Syntax-Highlighter.rar

Re: external editor syntax highlighting

Posted: Sat Sep 29, 2012 7:27 pm
by acim
Is there plugin for Sublime Text 2? It's a great editor.

Re: external editor syntax highlighting

Posted: Wed Nov 28, 2012 2:31 pm
by ABeepMike
I would really like to try this tool, but, I download Notepad++ and try to install the user defined .xml file here , but there is NO entry in the View Menu for User-defined dialouge....

THere are many many entries in that menu...just not THAT one....I am using ver 6.22


Am I missing something here.....

Re: external editor syntax highlighting

Posted: Thu Nov 29, 2012 5:05 am
by skot
It must have been moved in a new version...

Now it's in Language > Define your language...
screen1.gif
or you can import it by going to Settings > Import > Import style theme(s)...
screen2.gif

Re: external editor syntax highlighting

Posted: Thu Nov 29, 2012 5:55 am
by skot
I've made some improvements to the colour scheme (matching what's in winbox) and added a bunch more keywords; do you mind if I upload a copy of my modified version here and host another one on my website?
I like the improvements! Cool 8)

Re: external editor syntax highlighting

Posted: Sat Dec 15, 2012 6:05 pm
by ndbjorne
Hi,
my editor of choice is VIM and here's my VIM syntax file based on dtoffo's work.

Linux HowTo:
create your own syntax repository
[b]mkdir -p ~/.vim/syntax[/b]
and copy there "rsc.vim", then edit
[b]~/.vim/scripts.vim[/b]
and add lines to let vim recognize them.
Just in case this is your first custom syntax file here's the content for a minimal scripts.vim file:
[b]" Vim support file to detect file types in scripts
"
" first line check
let s:first_line = getline(1)

"       Mikrotik RouterOS script
if      s:first_line =~ "^#.* by RouterOS"
        setfiletype rsc
endif

unlet s:first_line[/b]
Hope you'll like it.

Re: external editor syntax highlighting

Posted: Tue Aug 27, 2013 4:11 am
by efaden
Hi,
my editor of choice is VIM and here's my VIM syntax file based on dtoffo's work.

Linux HowTo:
create your own syntax repository
[b]mkdir -p ~/.vim/syntax[/b]
and copy there "rsc.vim", then edit
[b]~/.vim/scripts.vim[/b]
and add lines to let vim recognize them.
Just in case this is your first custom syntax file here's the content for a minimal scripts.vim file:
[b]" Vim support file to detect file types in scripts
"
" first line check
let s:first_line = getline(1)

"       Mikrotik RouterOS script
if      s:first_line =~ "^#.* by RouterOS"
        setfiletype rsc
endif

unlet s:first_line[/b]
Hope you'll like it.
I'll throw my vote in for TextMate 2 or Sublime Text 2/3 ... If anyone has done them yet.

-Eric

Re: external editor syntax highlighting

Posted: Mon Sep 09, 2013 5:25 pm
by jarda
I wonder why the syntax check (and debugging) is not already implmented in ROS/WinBox...

Re: external editor syntax highlighting

Posted: Tue Sep 10, 2013 2:59 pm
by boen_robot
I wonder why the syntax check (and debugging) is not already implmented in ROS/WinBox...
Syntax highliting and check is kind of implemented in RouterOS already.

You just need to call the "edit" command on a script to open it in the whole terminal window, where you have that. The syntax check stops at the first syntax error though, but still.

Re: external editor syntax highlighting

Posted: Tue Sep 10, 2013 3:40 pm
by mrz
Or simply run /system script print.

Re: external editor syntax highlighting

Posted: Sun Sep 22, 2013 2:26 am
by skot
Hi,
my editor of choice is VIM and here's my VIM syntax file based on dtoffo's work.

Linux HowTo:
create your own syntax repository
mkdir -p ~/.vim/syntax
and copy there "rsc.vim", then edit
~/.vim/scripts.vim
and add lines to let vim recognize them.
Just in case this is your first custom syntax file here's the content for a minimal scripts.vim file:
" Vim support file to detect file types in scripts
"
" first line check
let s:first_line = getline(1)

"       Mikrotik RouterOS script
if      s:first_line =~ "^#.* by RouterOS"
        setfiletype rsc
endif

unlet s:first_line
Hope you'll like it.

:arrow: To make it a little easier, you can also have Vim recognize scripts simply by the .rsc extension:

Add the folder:
mkdir -p ~/.vim/ftdetect
Create the file: ~/.vim/ftdetect/rsc.vim with contents:
au BufRead,BufNewFile *.rsc set filetype=rsc
Then you don't have to have the "# by RouterOS" comment in each script.

Re: external editor syntax highlighting

Posted: Fri Feb 14, 2014 12:36 pm
by Kentzo
Is there plugin for Sublime Text 2? It's a great editor.
See http://forum.mikrotik.com/viewtopic.php?f=9&t=81868.

Re: external editor syntax highlighting

Posted: Fri May 09, 2014 1:57 am
by taduikis
Does anyone have a syntax highlighting file (.stx) for EditPlus?

These guys seem to have it: http://bbs.routerclub.com/thread-70366-1-1.html
But their forum is closed for public registration and it's not possible to download attachments.. :(

The highlight scheme is not perfect, but it'd be okay..
Image

Re: external editor syntax highlighting

Posted: Wed Jun 04, 2014 12:05 pm
by JoeriBe
Anyone has it for textWrangler ?

Thx.

Re: external editor syntax highlighting

Posted: Sun May 15, 2016 4:43 am
by ofstudio
RouterOS script syntax highlighting for Atom editor.
https://atom.io/packages/language-routeros-script

Re: external editor syntax highlighting

Posted: Wed May 18, 2016 8:09 am
by IntrusDave
Anyone has it for textWrangler ?

Thx.
+1 for this :)

Re: external editor syntax highlighting

Posted: Mon May 30, 2016 11:43 am
by ZEDA
I edit my configuration offline the routeros, so syntax highlighting would be a good help.
I use notepad++ and this morning made a "user defined lang" highlighting schema for .rsc files. I attach it (zipped).

Sure it's not perfect, but if anyone has better editor with routeros syntax, let me know!

d
Thanks

Re: external editor syntax highlighting

Posted: Thu Jun 02, 2016 1:29 am
by javierc
I wonder why the syntax check (and debugging) is not already implmented in ROS/WinBox...
Syntax highliting and check is kind of implemented in RouterOS already.

You just need to call the "edit" command on a script to open it in the whole terminal window, where you have that. The syntax check stops at the first syntax error though, but still.
Hi, I not understand this post... is possible open the script and edit directly from winbox with external editor as notepad++ or any other and check the sintax or always is needed download the file first and after upload again with each modification? I tried with ip smb but only see pub folder and the / folder but I not see the scripts, I see all files that I can see like in Winbox in menu files.

Please can you explain the process, please?

Regards

Re: external editor syntax highlighting

Posted: Thu Jun 02, 2016 2:24 am
by boen_robot
When I said "open it in the whole terminal window" I meant it. You can't open the script in an external program, and have syntax highlighting there... Well, not natively at least. There are 3rd party add-ons for various editors in this topic, though they are - by virtue of not being in sync with an actual router - error prone (e.g. newer commands/arguments may not be recognized as valid OR there won't be any sort of validation check at all, which in turn limits the usefulness of the highlighting).

If you open up Winbox, click the "New Terminal" button, and from there, type "/system script edit scriptName source" (replacing "scriptName" with the actual name of the script), the terminal windows turns into an editor with syntax highlighting... A very inconvenient to use editor, but an editor still.

Re: external editor syntax highlighting

Posted: Fri Jun 03, 2016 12:59 am
by javierc
When I said "open it in the whole terminal window" I meant it. You can't open the script in an external program, and have syntax highlighting there... Well, not natively at least. There are 3rd party add-ons for various editors in this topic, though they are - by virtue of not being in sync with an actual router - error prone (e.g. newer commands/arguments may not be recognized as valid OR there won't be any sort of validation check at all, which in turn limits the usefulness of the highlighting).

If you open up Winbox, click the "New Terminal" button, and from there, type "/system script edit scriptName source" (replacing "scriptName" with the actual name of the script), the terminal windows turns into an editor with syntax highlighting... A very inconvenient to use editor, but an editor still.
Ok, edit option is better that the option in the script window, I think the winbox tool is very good and powerful so I do not think that will prove very complex and it would be much better if implemented to open the default editor windows or associate the user as do the ftp programs or other would be great.

Another option would be that there were scripts like other normal files, so be resolved by SMB like any file.

I was reading the link you say, is like I was doint with notepadd++ and the addon for router os code, so I understand the 3rd party add-ons you say is for copy the code in thats applications, edit and paste in the script windows, it is so or is possible install any addon in winbox to do it?

Thanks

Re: external editor syntax highlighting

Posted: Tue Nov 15, 2016 12:00 am
by susan123
When I said "open it in the whole terminal window" I meant it. You can't open the script in an external program, and have syntax highlighting there... Well, not natively at least. There are 3rd party add-ons for various editors in this topic, though they are - by virtue of not being in sync with an actual router - error prone (e.g. newer commands/arguments may not be recognized as valid OR there won't be any sort of validation check at all, which in turn limits the usefulness of the highlighting).

If you open up Winbox, click the "New Terminal" button, and from there, type "/system script edit scriptName source" (replacing "scriptName" with the actual name of the script), the terminal windows turns into an editor with syntax highlighting... A very inconvenient to use editor, but an editor still.
Ok, edit option is better that the option in the script window, I think the winbox tool is very good and powerful so I do not think that will prove very complex and it would be much better if implemented to open the default editor windows or associate the user as do the ftp programs or other would be great.

Another option would be that there were scripts like other normal files, so be resolved by SMB like any file.

I was reading the link you say, is like I was doint with notepadd++ and the addon for router os code, so I understand the 3rd party add-ons you say is for copy the code in thats applications, edit and paste in the script windows, it is so or is possible install any addon in winbox to do it?

Thanks
Thanks for clarification!
tachophobiaipledge

Re: external editor syntax highlighting

Posted: Thu Mar 23, 2017 7:32 am
by lukoramu
Any suggestions how to syntax-highlight RouterOS scripts/configs in LibreOffice or MS Office documents ? :-)
Maybe someone have made a plugin for that? ..

Meanwhile, I'm using THIS post to syntax-highlight some RouterOS config, an then copy-paste it as "Formated text" into LibreOffice document :-)
# There was some code to highlight, but, turns out, it doesn't work that way..
# How in the hell it worked yesterday?? I really saw colored code in my LibreOffice, when I pasted it.. Hmm..

Re: external editor syntax highlighting

Posted: Thu Mar 23, 2017 10:57 am
by normis
Any suggestions how to syntax-highlight RouterOS scripts/configs in LibreOffice or MS Office documents ? :-)
Maybe someone have made a plugin for that? ..

Meanwhile, I'm using THIS post to syntax-highlight some RouterOS config, an then copy-paste it as "Formated text" into LibreOffice document :-)
# There was some code to highlight, but, turns out, it doesn't work that way..
# How in the hell it worked yesterday?? I really saw colored code in my LibreOffice, when I pasted it.. Hmm..
Don't use Libre or MS Office for code :D
I suggest Visual Studio Code, TextWrangler, Notepad++, Sublime, etc

Re: external editor syntax highlighting

Posted: Thu Jun 01, 2017 2:06 am
by sreed
I edit my configuration offline the routeros, so syntax highlighting would be a good help.
I use notepad++ and this morning made a "user defined lang" highlighting schema for .rsc files. I attach it (zipped).

Sure it's not perfect, but if anyone has better editor with routeros syntax, let me know!

d
This is awesome.
I added dst-host, redirect-to, cache-path and owner as keywords.

Re: external editor syntax highlighting

Posted: Thu Jan 18, 2018 12:22 pm
by alebu
I upgraded the old (2012) notepad++ highlitghter with a lot of new keyword (about tool, email, logging, package, ups, radius, capsman, etc, etc, etc,).
I attach it (zipped).

Unzip the xml file in your desktop and then in Notepad++ go to: Language->User Defined Language->Import
Close and reopen Notepad++

thanks to dtoffo for his initial work in 2012.

Re: external editor syntax highlighting

Posted: Mon Feb 12, 2018 11:34 am
by freecowz
This is really useful - thank you!

Re: external editor syntax highlighting

Posted: Tue Feb 13, 2018 1:02 am
by Danny78
I upgraded the old (2012) notepad++ highlitghter with a lot of new keyword (about tool, email, logging, package, ups, radius, capsman, etc, etc, etc,).
I attach it (zipped).

thanks to dtoffo for his initial work in 2012.
Thank you very much!

Re: external editor syntax highlighting

Posted: Fri Mar 09, 2018 9:02 am
by Joni
How about contributing the package too... https://notepad-plus-plus.org/contribute/