I really love the REPL in scriptcs, and feel comfortable using it. But sometimes, when writing larger scripts its just not a suitable tool. Then it is good that there are other, still lightweight, options out there.
In this post I’ll show you how to setup Sublime Text and Atom to use scriptcs for script execution.
Sublime Text
Sublime Text has been my favorite text editor for a while, and I use every occasion I get to give it a shout, and hopefully I can convince more people to use it.
To setup using scriptcs in Sublime Text, you need to install the scriptcs plugin. This is done using the great Sublime Package Manager. The Sublime Package Manager is in it self an addon. So open the Sublime Text console, using Ctrl+´
, and run this Powershell script. When you have installed the Sublime Package Manager, open it by using the Ctrl+Shift+P
, type install
and choose Package Control: Install Package
. Now the repositories will be refreshed. Once ready, a dialog will list all available packages. Then type scriptcs
, and press enter
. The scriptcs package will now be installed.
When installed, all .csx
-files will now have text highlighting and you can execute your scripts by pressing Ctrl+B
.
SublimeREPL
I neat feature that Sublime Text has and which, not to my knowledge, Atom does not have is SublimeRepl or rather an alternative. SublimeREPL is a Sublime Text package which adds a REPL inside Sublime. This REPL is highly configurable, and can run an interpreter inside Sublime, including scriptcs. Again, open the Sublime Package Manager, using Ctrl+Shift+P
, type install
and chose Package Control: Install Package
. Find SublimeREPL
in the list and install it.
When installation is done, you can find the scriptcs REPL in Tools -> SublimeREPL -> ScriptCS
.
Atom
The new kid on the block. It is a bit more cumbersome to get scriptcs set up in Atom. Firstly, you need to install the Atom Runner. You would either go through the Atom Package Manager GUI, which is found in the Settings tab (Ctrl-,
) or take it from the command line like this
To get C# highlighting in your scripts you’d also have to add an additional package
Now we need to associate Atom with the .csx
file extension. Open you local config file
This open the config file. Add the following to the config file
Save the file using Ctrl+S
. Now you can write your scripts, save them with the .csx
file extension and run them using the Atom Runner
Press ‘R’ and select Runner: Run
.
I hope this can help someone getting started using scriptcs. Throw a comment, or give me a shout on Twitter.