Community discussions

MikroTik App
 
dtoffo
Trainer
Trainer
Topic Author
Posts: 98
Joined: Tue May 17, 2011 9:19 am

external editor syntax highlighting

Tue Feb 28, 2012 3:28 pm

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
You do not have the required permissions to view the files attached to this post.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: external editor syntax highlighting

Thu Mar 01, 2012 12:38 pm

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.
 
thegink
just joined
Posts: 3
Joined: Wed Oct 12, 2011 5:02 am

Re: external editor syntax highlighting

Wed Mar 07, 2012 1:42 am

I use Textpad for the same thing - I've attached the syntax definition file I wrote for .rsc files.

t
You do not have the required permissions to view the files attached to this post.
 
gsloop
Member Candidate
Member Candidate
Posts: 213
Joined: Wed Jan 04, 2012 11:34 pm
Contact:

Re: external editor syntax highlighting

Mon Mar 12, 2012 8:34 pm

@dtoffo

Cool! Thanks!

-Greg
 
senzatempo
just joined
Posts: 14
Joined: Sat Feb 03, 2007 11:48 am
Location: rome

Re: external editor syntax highlighting

Sat Mar 24, 2012 2:24 am

thanks ..

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

SENZATEMPO
 
dtoffo
Trainer
Trainer
Topic Author
Posts: 98
Joined: Tue May 17, 2011 9:19 am

Re: external editor syntax highlighting

Mon Mar 26, 2012 7:07 pm

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
 
User avatar
skot
Long time Member
Long time Member
Posts: 584
Joined: Wed Nov 30, 2011 3:05 am

Re: external editor syntax highlighting

Thu Apr 26, 2012 8:51 pm

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
 
angboontiong
Forum Guru
Forum Guru
Posts: 1136
Joined: Fri Jan 16, 2009 9:59 am

Re: external editor syntax highlighting

Mon May 28, 2012 6:17 pm

Hi all...

may i know how to use this?

thanks.
 
User avatar
skot
Long time Member
Long time Member
Posts: 584
Joined: Wed Nov 30, 2011 3:05 am

Re: external editor syntax highlighting

Thu May 31, 2012 5:37 am

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.
 
angboontiong
Forum Guru
Forum Guru
Posts: 1136
Joined: Fri Jan 16, 2009 9:59 am

Re: external editor syntax highlighting

Sat Jun 02, 2012 5:59 pm

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...
 
User avatar
omega-00
Forum Guru
Forum Guru
Posts: 1167
Joined: Sat Jun 06, 2009 4:54 am
Location: Australia
Contact:

Re: external editor syntax highlighting

Tue Jul 17, 2012 5:33 pm

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?
 
dtoffo
Trainer
Trainer
Topic Author
Posts: 98
Joined: Tue May 17, 2011 9:19 am

Re: external editor syntax highlighting

Wed Jul 18, 2012 12:43 pm

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
 
User avatar
omega-00
Forum Guru
Forum Guru
Posts: 1167
Joined: Sat Jun 06, 2009 4:54 am
Location: Australia
Contact:

Re: external editor syntax highlighting

Wed Jul 18, 2012 3:04 pm

Here you go!
RouterOS-Syntax-Highlighter.rar
You do not have the required permissions to view the files attached to this post.
 
User avatar
acim
Member
Member
Posts: 415
Joined: Mon Sep 12, 2005 12:26 am
Location: Serbia
Contact:

Re: external editor syntax highlighting

Sat Sep 29, 2012 7:27 pm

Is there plugin for Sublime Text 2? It's a great editor.
 
ABeepMike
Frequent Visitor
Frequent Visitor
Posts: 51
Joined: Tue Nov 10, 2009 10:37 pm

Re: external editor syntax highlighting

Wed Nov 28, 2012 2:31 pm

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.....
 
User avatar
skot
Long time Member
Long time Member
Posts: 584
Joined: Wed Nov 30, 2011 3:05 am

Re: external editor syntax highlighting

Thu Nov 29, 2012 5:05 am

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
You do not have the required permissions to view the files attached to this post.
 
User avatar
skot
Long time Member
Long time Member
Posts: 584
Joined: Wed Nov 30, 2011 3:05 am

Re: external editor syntax highlighting

Thu Nov 29, 2012 5:55 am

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)
 
ndbjorne
just joined
Posts: 23
Joined: Sat Dec 15, 2012 5:06 pm
Location: Italy

Re: external editor syntax highlighting

Sat Dec 15, 2012 6:05 pm

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.
You do not have the required permissions to view the files attached to this post.
 
efaden
Forum Guru
Forum Guru
Posts: 1708
Joined: Sat Mar 30, 2013 1:55 am
Location: New York, USA

Re: external editor syntax highlighting

Tue Aug 27, 2013 4:11 am

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
 
jarda
Forum Guru
Forum Guru
Posts: 7756
Joined: Mon Oct 22, 2012 4:46 pm

Re: external editor syntax highlighting

Mon Sep 09, 2013 5:25 pm

I wonder why the syntax check (and debugging) is not already implmented in ROS/WinBox...
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: external editor syntax highlighting

Tue Sep 10, 2013 2:59 pm

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.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7038
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: external editor syntax highlighting

Tue Sep 10, 2013 3:40 pm

Or simply run /system script print.
 
User avatar
skot
Long time Member
Long time Member
Posts: 584
Joined: Wed Nov 30, 2011 3:05 am

Re: external editor syntax highlighting

Sun Sep 22, 2013 2:26 am

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.
 
User avatar
Kentzo
Long time Member
Long time Member
Posts: 512
Joined: Mon Jan 27, 2014 3:35 pm
Location: California

Re: external editor syntax highlighting

Fri Feb 14, 2014 12:36 pm

Is there plugin for Sublime Text 2? It's a great editor.
See http://forum.mikrotik.com/viewtopic.php?f=9&t=81868.
 
taduikis
Member
Member
Posts: 436
Joined: Sat Jul 07, 2007 12:09 pm

Re: external editor syntax highlighting

Fri May 09, 2014 1:57 am

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
 
JoeriBe
just joined
Posts: 7
Joined: Tue Sep 10, 2013 10:03 am

Re: external editor syntax highlighting

Wed Jun 04, 2014 12:05 pm

Anyone has it for textWrangler ?

Thx.
 
ofstudio
just joined
Posts: 1
Joined: Sun May 15, 2016 4:38 am

Re: external editor syntax highlighting

Sun May 15, 2016 4:43 am

RouterOS script syntax highlighting for Atom editor.
https://atom.io/packages/language-routeros-script
 
IntrusDave
Forum Guru
Forum Guru
Posts: 1286
Joined: Fri May 09, 2014 4:36 am
Location: Rancho Cucamonga, CA

Re: external editor syntax highlighting

Wed May 18, 2016 8:09 am

Anyone has it for textWrangler ?

Thx.
+1 for this :)
 
ZEDA
just joined
Posts: 7
Joined: Thu Apr 03, 2014 4:33 pm

Re: external editor syntax highlighting

Mon May 30, 2016 11:43 am

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
 
javierc
newbie
Posts: 36
Joined: Sat Aug 03, 2013 4:29 am

Re: external editor syntax highlighting

Thu Jun 02, 2016 1:29 am

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
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: external editor syntax highlighting

Thu Jun 02, 2016 2:24 am

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.
 
javierc
newbie
Posts: 36
Joined: Sat Aug 03, 2013 4:29 am

Re: external editor syntax highlighting

Fri Jun 03, 2016 12:59 am

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
 
lukoramu
just joined
Posts: 18
Joined: Mon Jan 07, 2013 11:11 am

Re: external editor syntax highlighting

Thu Mar 23, 2017 7:32 am

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..
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26291
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: external editor syntax highlighting

Thu Mar 23, 2017 10:57 am

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
 
sreed
just joined
Posts: 4
Joined: Sat Mar 12, 2016 4:50 pm
Location: Centerville IN
Contact:

Re: external editor syntax highlighting

Thu Jun 01, 2017 2:06 am

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.
 
alebu
just joined
Posts: 2
Joined: Wed Jan 10, 2018 9:58 am

Re: external editor syntax highlighting

Thu Jan 18, 2018 12:22 pm

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.
You do not have the required permissions to view the files attached to this post.
 
freecowz
just joined
Posts: 1
Joined: Mon Feb 12, 2018 10:32 am

Re: external editor syntax highlighting

Mon Feb 12, 2018 11:34 am

This is really useful - thank you!
 
Danny78
just joined
Posts: 1
Joined: Sun Nov 06, 2016 4:45 pm
Location: Germany

Re: external editor syntax highlighting

Tue Feb 13, 2018 1:02 am

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!
 
User avatar
Joni
Member Candidate
Member Candidate
Posts: 156
Joined: Fri Mar 20, 2015 2:46 pm
Contact:

Re: external editor syntax highlighting

Fri Mar 09, 2018 9:02 am

How about contributing the package too... https://notepad-plus-plus.org/contribute/
 
User avatar
eworm
Forum Guru
Forum Guru
Posts: 1070
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: external editor syntax highlighting

Mon Oct 12, 2020 5:13 pm

My editor of choice is vis - a modern, legacy free, simple yet efficient vim-like editor.
I added a RouterOS script lexer, that is now available in git master.
 
VitaliySte
just joined
Posts: 3
Joined: Mon May 07, 2018 11:12 am

syntax highlighting for Kate

Thu Jan 14, 2021 2:09 pm

Highlighting for Kate (editor in KDE5)
Create (if not exist) folder ~/.local/share/katepart5/syntax/ and place xml file there
RouterOS.xml
Restart Kate, than open Kate settings and in colors settings in style select RouterOS highlighting and import from file RouterOS.katehlcolor from archive
RouterOS.katehlcolor.zip
(unpack it before!)
You can set you own colors and text style also in this menu
You do not have the required permissions to view the files attached to this post.
 
User avatar
dll2003
newbie
Posts: 28
Joined: Sun Feb 16, 2020 11:35 am
Location: Moscow, Russia
Contact:

Re: external editor syntax highlighting

Thu Feb 25, 2021 5:34 pm

Hello everyone!
Maybe someone has already done syntax highlighting in UltraEdit?
If so, please share the .uew file.
Thanks.
 
User avatar
robmaltsystems
Long time Member
Long time Member
Posts: 535
Joined: Fri Jun 21, 2019 12:04 pm

Re: external editor syntax highlighting

Fri May 21, 2021 7:56 pm

Thanks for this - something I've wished for ages and here it is!
 
User avatar
JimGrisham
just joined
Posts: 6
Joined: Thu Jan 28, 2021 6:25 am

Re: syntax highlighting for Kate

Wed May 26, 2021 11:45 pm

Highlighting for Kate (editor in KDE5)
Create (if not exist) folder ~/.local/share/katepart5/syntax/ and place xml file there RouterOS.xml
Restart Kate, than open Kate settings and in colors settings in style select RouterOS highlighting and import from file RouterOS.katehlcolor from archive RouterOS.katehlcolor.zip (unpack it before!)
You can set you own colors and text style also in this menu

Thanks!

For anyone using Kate on Windows, put the RouterOS.xml file here:
%USERPROFILE%\AppData\Local\org.kde.syntax-highlighting\syntax\

(create org.kde.syntax-highlighting and syntax if they do not already exist.)

Reference for that file location:

(If you're looking to install the RouterOS.katehlcolor file on Windows, though, I can't help.)
 
User avatar
jousedelano
just joined
Posts: 12
Joined: Wed Aug 11, 2021 6:50 am

Re: external editor syntax highlighting

Thu Apr 07, 2022 2:39 pm

Just use VS Code, someone has made an extension with highlighting. Ain't got time to reinvent the wheel
 
msatter
Forum Guru
Forum Guru
Posts: 2897
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: external editor syntax highlighting

Thu Apr 07, 2022 2:47 pm

Which editor(s) do you use?
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: external editor syntax highlighting

Thu Apr 07, 2022 2:56 pm

It act like a BOT:
"Ain't got time to reinvent the wheel"
 
WeWiNet
Long time Member
Long time Member
Posts: 591
Joined: Thu Sep 27, 2018 4:11 pm

Re: external editor syntax highlighting

Thu Apr 07, 2022 5:39 pm

Which editor(s) do you use?
Atom with highlighting extension from ofstudio
https://atom.io/packages/language-routeros-script

Who is online

Users browsing this forum: cosinguyen93, eldoncito2019 and 20 guests