Git Product home page Git Product logo

sublime-worksheet's Introduction

Sublime Worksheet

This is a Sublime Text 2 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.

a

It's great for trying things out directly in Sublime Text.

Please note: this plugin does not work on Windows. See this issue for more information.

Languages

Sublime worksheet currently supports the following languages:

  • JavaScript (using NodeJS)
  • PHP
  • Python
  • Ruby
  • Scala

Sublime Worksheet uses the interpreters that are available on your system. This means that, for example, you need the IRB executable installed and on your path in order to evaluate Ruby worksheets. If you can run a REPL from the command line then the plugin should have no problem running it.

Install

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.

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.

sublime-worksheet's People

Contributors

jcartledge avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.