external editor syntax highlighting

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.

Or simply run /system script print.

:arrow_right: 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.

See http://forum.mikrotik.com/t/syntax-highlighting-and-completions-for-sublime-text/74259/1

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.. :frowning:

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

Anyone has it for textWrangler ?

Thx.

RouterOS script syntax highlighting for Atom editor.
https://atom.io/packages/language-routeros-script

+1 for this :slight_smile:

Thanks

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

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

Any suggestions how to syntax-highlight RouterOS scripts/configs in LibreOffice or MS Office documents ? :slight_smile:
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 :slight_smile:

# 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 :smiley:
I suggest Visual Studio Code, TextWrangler, Notepad++, Sublime, etc

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

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.
RouterOS-Syntax-Highlighter-alebu.zip (4.08 KB)

This is really useful - thank you!

Thank you very much!

How about contributing the package too… https://notepad-plus-plus.org/contribute/

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.