Code Monkey home page Code Monkey logo

run-in-terminal-bundle's Introduction

Run in Terminal (TextMate bundle)

A simple TextMate 1.5 bundle to run Python, Ruby, PHP, Bash scripts in Terminal.app without stealing focus from the TextMate window. It can easily be modified to run %YOUR_FAVORITE_LANGUAGE%. If you added support for a new language, please make a pull request to update this repository or email your changes to the author.

Installation

  1. Download and extract the archive.
  2. Double click “Run in Terminal.tmbundle”. TextMate will then install the bundle.

Usage

Press Cmd + Shift + R to run your script. If any other bundles share this hotkey, TextMate will show a pop-up menu where you’d need to select Run in Terminal → Run Python/Ruby/PHP...:

If you don’t want this menu to appear, use Bundle Editor to edit out the hotkey from “conflicting” bundles or set a different hotkey for commands in this bundle.

How does it work

The bundle uses AppleScript to create (if necessary) a Terminal.app window running a GNU Screen session named “TextMate”, which receives commands to run your script. Such a window is internally referenced as an “executor”. After running a script, “executor” displays execution time measured with Unix time command.

For Python projects, the bundle respects TM_PYTHON environment variable (if set). If you use virtualenv, set TM_PYTHON to the full path to Python binary inside your virtualenv directory. Note that TextMate does not understand ~/..., use /Users/username/... instead.

Known problems

Only tested with TextMate 1.5.11 and Mac OS X 10.8 (“Mountain Lion”).

  • Sometimes the “executor” may take up to 30 seconds to initialize while displaying a message saying “New screen”.
  • Bash commands used to run scripts are saved in bash history as if a user typed them.

Credits & license

Written by Eugene / Dae ([email protected]).

Any feedback is appreciated. Feel free to use the code under the terms of the MIT License (see LICENSE).

run-in-terminal-bundle's People

Contributors

eugenedae avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

anhelka123

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.