Worksheet
An inline REPL for JavaScript, PHP, Ruby & more in Sublime Text 2 and 3
Details
Installs
- Total 2K
- Win 645
- Mac 1K
- Linux 554
Dec 22 | Dec 21 | Dec 20 | Dec 19 | Dec 18 | Dec 17 | Dec 16 | Dec 15 | Dec 14 | Dec 13 | Dec 12 | Dec 11 | Dec 10 | Dec 9 | Dec 8 | Dec 7 | Dec 6 | Dec 5 | Dec 4 | Dec 3 | Dec 2 | Dec 1 | Nov 30 | Nov 29 | Nov 28 | Nov 27 | Nov 26 | Nov 25 | Nov 24 | Nov 23 | Nov 22 | Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | Nov 7 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
Sublime Worksheet
This is a Sublime Text plugin for Mac OS X and Linux which passes the contents of a buffer line-by-line to a REPL and displays the results inline.
It works in Sublime Text 2 and 3.
It's great for trying things out directly in Sublime Text.
Windows support Thanks to @timonwong v0.8.0 introduces experimental Windows support. Please report any issues you discover.
In this document
Installation
Package Control
Package Control is “a full-featured package manager that helps discovering, installing, updating and removing packages for SublimeText 2.” It's the preferred way to manage your SublimeText 2 Packages directory.
Follow these instructions to install Sublime-worksheet with Package Control.
Using Git
Go to your SublimeText 2 Packages
directory and clone the repository using the command below:
$ git clone https://github.com/jcartledge/sublime-worksheet.git
Download Manually
Download the files using the .zip download option.
Unzip the files.
Copy the folder to your SublimeText 2 Packages directory.
Usage
Sublime Worksheet provides two commands which you can access from the command palette (CMD-SHIFT-P / CTRL-SHIFT-P):
Worksheet: Evaluate worksheet
Passes the contents of the current document line by line to the interpreter which matches its syntax setting.
Results are inserted as comments directly below the statement, as they would appear if you were entering them in the REPL.
This automatically clears the results of previous evaluations first.
You don't need to save the document before running Evaluate worksheet
, but if it has been saved then you can write imports/requires/includes relative to the file and they should work.
Any errors or timeouts will cause evaluation to stop and the error to be written to the document. A timeout occurs if the REPL hasn't returned a result for an evaluated line after 10 seconds.
Worksheet: Clear worksheet results
Removes comments inserted by evaluating the worksheet.
Overide settings
You also can override Sublime Worksheet settings per-project so you can use your virtual environnement. For example, to add your virtualenv, just append this to your .sublime-project
file:
"settings": {
"worksheet_languages": {
"Python": {
"cmd": "/home/adrien/.pyenvs/web2/bin/python -i",
"prompt": [">>> ", "\\.\\.+ "],
"prefix": "# > ",
"error": ["Traceback ", " File \"<stdin>\","]
},
}
}
Please see the worksheet.sublime-settings
for more configuration examples.
Supported Languages
Sublime worksheet uses the interpreters you have installed on your system. Generally speaking if you can run an interpreter from the command line it should work in Sublime Text. The following languages are supported:
Elixir
Uses the iex
interpreter running on the Erlang VM.
JavaScript
Uses the interactive mode of the NodeJS command line interpreter.
Perl
Uses re.pl
which is provided by the Devel::REPL
package.
- Install via CPAN:
# You may need to run these as root
cpan -i Devel::REPL
# You also need to install a readline implemetation:
cpan -i Term::ReadLine::Perl
- Install using your OS package manager e.g.
apt-get install libdevel-repl-perl
PHP
Uses the PHP CLI executable in interactive mode (php -a
).
See your OS package manager documentation or the PHP website for help setting this up.
Python
Uses the interactive mode of the Python binary (python -i
).
See your OS package manager documentation or the Python website for help setting this up.
Ruby
Uses irb
.
See your OS package manager documentation or the Ruby website for help setting this up.
Scala
Uses the Scala REPL.
See your OS package manager documentation or the Scala website for help setting this up.
Racket/Scheme
Uses Guile.
See your OS package manager documentation or the Guile website for help setting this up.
Known issues
Python IndentationError
There is an issue where code which is interpreted correctly by non-interactive Python causes an indentation error in interactive Python.
This arises when indented lines are separated by one or more unindented blank lines. The simple workaround is to indent the blank lines to the level of the surrounding indentation.
For more information see this issue or this StackOverflow thread.
Contributing
Please feel free. More REPLs would be great - take a look at worksheet.sublime-settings (and this pull request) for details of how these are implemented.