schmty / atom-script

Run ( scripts | selections | source ) in Atom

Home Page:https://atom.io/packages/script

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Run code in Atom!

Run selections of code, code based on line number, or the whole file!

Currently supported grammars are:

  • AppleScript
  • Bash
  • Behat Feature
  • Coffeescript
  • CoffeeScript (Literate) ^
  • Cucumber (Gherkin) *
  • Elixir
  • Erlang
  • F# *
  • Go *
  • Groovy
  • Haskell
  • Javascript
  • Julia
  • LiveScript
  • Lua
  • MoonScript
  • newLISP
  • Perl
  • PHP
  • Python
  • RSpec
  • Ruby
  • Scala

NOTE: Some grammars may require you to install a custom language package.

You only have to add a few lines in a PR to support another.

Limitations

^ Running selections of code for CoffeeScript (Literate) only works when selecting just the code blocks

Erlang uses erl for limited selection based runs (see #70)

* Cucumber (Gherkin), Go, and F# do not support selection based runs

Installation

apm install script

or

Search for script within package search in the Settings View.

Atom can't find node | ruby | python | my socks

Make sure to launch Atom from the console/terminal. This gives atom all your useful environment variables.

If you really wish to open atom from a launcher/icon, see this issue for a variety of workarounds that have been suggested.

Usage

Make sure to run atom from the command line to get full access to your environment variables. Running Atom from the icon will launch using launchctl's environment.

Script: Run will perform a "File Based" run when no text is selected (default).

Script: Run while text is selected will perform a "Selection Based" run executing just the highlighted code.

Script: Run at Line to run using the specified line number. Note that if you select an entire line this number could be off by one due to the way Atom detects numbers while text is selected.

Script: Run Options should be used to configure command options and program arguments for a "File Based" or "Selection Based" run.

Script: Kill Process will kill the process but leaves the pane open.

Script: Close View closes the pane and kills the process.

To kill everything, click the close icon in the upper right and just go back to coding.

Command and shortcut reference

Command Mac OS X Linux/Windows Notes
Script: Run cmd-i ctrl-b If text is selected a "Selection Based" is used instead of a "File Based" run
Script: Run at Line shift-cmd-j shift-ctrl-j If text is selected the line number will be the last
Script: Run Options shift-cmd-i shift-ctrl-alt-o Runs the selection or whole file with the given options
Script: Close View ctrl-w ctrl-w Closes the script view window
Script: Kill Process ctrl-c ctrl-q Kills the current script process

Development

Use the atom contributing guidelines. They're pretty sane.

Quick and dirty setup

apm develop script

This will clone the script repository to ~/github unless you set the ATOM_REPOS_HOME environment variable.

I already cloned it!

If you cloned it somewhere else, you'll want to use apm link --dev within the package directory, followed by apm install to get dependencies.

Workflow

After pulling upstream changes, make sure to run apm update.

To start hacking, make sure to run atom --dev from the package directory. Cut a branch while you're working then either submit a Pull Request when done or when you want some feedback!

About

Run ( scripts | selections | source ) in Atom

https://atom.io/packages/script

License:MIT License


Languages

Language:CoffeeScript 76.1%Language:Prolog 6.0%Language:PHP 4.1%Language:CSS 3.4%Language:Python 3.2%Language:Ruby 2.2%Language:Julia 1.5%Language:Groovy 0.9%Language:JavaScript 0.6%Language:Scala 0.4%Language:Lua 0.3%Language:Common Lisp 0.3%Language:Erlang 0.3%Language:Go 0.3%Language:Haskell 0.2%Language:Elixir 0.2%Language:Shell 0.1%Language:Rust 0.1%