scriptcs in Sublime Text and Atom
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 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
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
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
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.
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
apm install atom-runner
To get C# highlighting in your scripts you'd also have to add an additional package
apm install language-csharp
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
'runner': 'extensions': 'csx': 'scriptcs'
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
I hope this can help someone getting started using scriptcs. Throw a comment, or give me a shout on Twitter.Tweet
comments powered by Disqus