Community discussions

 
dtoffo
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 81
Joined: Tue May 17, 2011 9:19 am
Reputation: 0

external editor syntax highlighting

Tue Feb 28, 2012 4: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
Attachments
n++_userdefined_routeros_rsc.zip
(3.51 KiB) Downloaded 3699 times
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6205
Joined: Tue Feb 14, 2006 10:46 am
Reputation: 16
Location: Riga, Latvia

Re: external editor syntax highlighting

Thu Mar 01, 2012 1: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
Reputation: 4

Re: external editor syntax highlighting

Wed Mar 07, 2012 2:42 am

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

t
Attachments
textpad syntax file.zip
Syntax definition file for Textpad 5
(835 Bytes) Downloaded 1390 times
 
gsloop
Member Candidate
Member Candidate
Posts: 213
Joined: Thu Jan 05, 2012 12:34 am
Reputation: 1
Contact:

Re: external editor syntax highlighting

Mon Mar 12, 2012 9:34 pm

@dtoffo

Cool! Thanks!

-Greg
- If I helped you solve your problem ... Karma is an appropriate gift! :) -
 
senzatempo
just joined
Posts: 13
Joined: Sat Feb 03, 2007 12:48 pm
Reputation: 0
Location: rome

Re: external editor syntax highlighting

Sat Mar 24, 2012 3:24 am

thanks ..

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

SENZATEMPO
 
dtoffo
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 81
Joined: Tue May 17, 2011 9:19 am
Reputation: 0

Re: external editor syntax highlighting

Mon Mar 26, 2012 7:07 pm

senzatempo wrote:
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: 585
Joined: Wed Nov 30, 2011 4:05 am
Reputation: 9

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
I don't need any karma... I have Ιησους Χριστος!
 
angboontiong
Forum Guru
Forum Guru
Posts: 1054
Joined: Fri Jan 16, 2009 10:59 am
Reputation: 1

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: 585
Joined: Wed Nov 30, 2011 4:05 am
Reputation: 9

Re: external editor syntax highlighting

Thu May 31, 2012 5:37 am

angboontiong wrote:
Hi all...

may i know how to use this?

thanks.


1. Download Notepad++: http://www.notepadplusplus.org
2. Install Notepad++
3. Download file above: viewtopic.php?f=9&t=59761#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.
I don't need any karma... I have Ιησους Χριστος!
 
angboontiong
Forum Guru
Forum Guru
Posts: 1054
Joined: Fri Jan 16, 2009 10:59 am
Reputation: 1

Re: external editor syntax highlighting

Sat Jun 02, 2012 5:59 pm

skot wrote:
angboontiong wrote:
Hi all...

may i know how to use this?

thanks.


1. Download Notepad++: http://www.notepadplusplus.org
2. Install Notepad++
3. Download file above: viewtopic.php?f=9&t=59761#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: 1150
Joined: Sat Jun 06, 2009 4:54 am
Reputation: 7
Location: Brisbane, Australia
Contact:

Re: external editor syntax highlighting

Tue Jul 17, 2012 5:33 pm

dtoffo wrote:
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?
brightwifi.com | mikrotik-routeros.com | MTCNA,MTCWE.MTCTCE | Give karma where due
 
dtoffo
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 81
Joined: Tue May 17, 2011 9:19 am
Reputation: 0

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: 1150
Joined: Sat Jun 06, 2009 4:54 am
Reputation: 7
Location: Brisbane, Australia
Contact:

Re: external editor syntax highlighting

Wed Jul 18, 2012 3:04 pm

Here you go!

RouterOS-Syntax-Highlighter.rar
(3.64 KiB) Downloaded 2224 times
brightwifi.com | mikrotik-routeros.com | MTCNA,MTCWE.MTCTCE | Give karma where due
 
User avatar
acim
Member
Member
Posts: 424
Joined: Mon Sep 12, 2005 12:26 am
Reputation: 0
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 11:37 pm
Reputation: 0

Re: external editor syntax highlighting

Wed Nov 28, 2012 3: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: 585
Joined: Wed Nov 30, 2011 4:05 am
Reputation: 9

Re: external editor syntax highlighting

Thu Nov 29, 2012 6:05 am

It must have been moved in a new version...

Now it's in Language > Define your language...
screen1.gif
screen1.gif (9.61 KiB) Viewed 27364 times

or you can import it by going to Settings > Import > Import style theme(s)...
screen2.gif
screen2.gif (9.55 KiB) Viewed 27364 times
I don't need any karma... I have Ιησους Χριστος!
 
User avatar
skot
Long time Member
Long time Member
Posts: 585
Joined: Wed Nov 30, 2011 4:05 am
Reputation: 9

Re: external editor syntax highlighting

Thu Nov 29, 2012 6:55 am

omega-00 wrote:
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)
I don't need any karma... I have Ιησους Χριστος!
 
ndbjorne
just joined
Posts: 17
Joined: Sat Dec 15, 2012 6:06 pm
Reputation: 0
Location: Italy

Re: external editor syntax highlighting

Sat Dec 15, 2012 7: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.
Attachments
rsc.vim.tgz
(4.43 KiB) Downloaded 489 times
Andrea
 
efaden
Forum Guru
Forum Guru
Posts: 1652
Joined: Sat Mar 30, 2013 2:55 am
Reputation: 23
Location: New York, USA

Re: external editor syntax highlighting

Tue Aug 27, 2013 4:11 am

ndbjorne wrote:
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: 5856
Joined: Mon Oct 22, 2012 4:46 pm
Reputation: 274

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: 2164
Joined: Thu Aug 31, 2006 4:43 pm
Reputation: 189
Location: europe://Bulgaria/Plovdiv

Re: external editor syntax highlighting

Tue Sep 10, 2013 2:59 pm

jarda wrote:
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.
PEAR2_Net_RouterOS(1.0.0b5) - My API client in PHP
(Rate my posts? If you want... no pressure...)
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 5027
Joined: Wed Feb 07, 2007 1:45 pm
Reputation: 46
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: 585
Joined: Wed Nov 30, 2011 4:05 am
Reputation: 9

Re: external editor syntax highlighting

Sun Sep 22, 2013 2:26 am

ndbjorne wrote:
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.
I don't need any karma... I have Ιησους Χριστος!
 
Kentzo
just joined
Posts: 17
Joined: Mon Jan 27, 2014 4:35 pm
Reputation: 0

Re: external editor syntax highlighting

Fri Feb 14, 2014 1:36 pm

acim wrote:
Is there plugin for Sublime Text 2? It's a great editor.

See http://forum.mikrotik.com/viewtopic.php?f=9&t=81868.
Syntax highlighting and completions for the Mikrotik scripting language in Sublime Text.
Available via Package Control.
 
taduikis
Member
Member
Posts: 387
Joined: Sat Jul 07, 2007 12:09 pm
Reputation: 1

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
Reputation: 0

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
Reputation: 0

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
 
User avatar
IntrusDave
Forum Veteran
Forum Veteran
Posts: 828
Joined: Fri May 09, 2014 4:36 am
Reputation: 64
Location: Southern California, USA

Re: external editor syntax highlighting

Wed May 18, 2016 8:09 am

JoeriBe wrote:
Anyone has it for textWrangler ?

Thx.


+1 for this :)
David Joyce
Network & Security Engineer
Intrus Technologies, LLC.
Rancho Cucamonga, CA, USA
 
ZEDA
just joined
Posts: 7
Joined: Thu Apr 03, 2014 4:33 pm
Reputation: 0

Re: external editor syntax highlighting

Mon May 30, 2016 11:43 am

dtoffo wrote:
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: 31
Joined: Sat Aug 03, 2013 4:29 am
Reputation: -1

Re: external editor syntax highlighting

Thu Jun 02, 2016 1:29 am

boen_robot wrote:
jarda wrote:
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: 2164
Joined: Thu Aug 31, 2006 4:43 pm
Reputation: 189
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.
PEAR2_Net_RouterOS(1.0.0b5) - My API client in PHP
(Rate my posts? If you want... no pressure...)
 
javierc
newbie
Posts: 31
Joined: Sat Aug 03, 2013 4:29 am
Reputation: -1

Re: external editor syntax highlighting

Fri Jun 03, 2016 12:59 am

boen_robot wrote:
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
 
susan123
just joined
Posts: 2
Joined: Tue Nov 15, 2016 12:53 am
Reputation: 0

Re: external editor syntax highlighting

Tue Nov 15, 2016 1:00 am

javierc wrote:
boen_robot wrote:
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!
Fordyce

Who is online

Users browsing this forum: No registered users and 2 guests