Code Monkey home page Code Monkey logo

inf-ruby's Introduction

inf-ruby provides a REPL buffer connected to a Ruby subprocess.

Installation

Via package.el

package.el is the built-in package manager in Emacs 24+. On Emacs 23 you will need to get package.el yourself if you wish to use it.

inf-ruby is available on both major package.el community maintained repos: Marmalade and MELPA.

If you're not already using one of them, follow their installation instructions: Marmalade, MELPA.

And then you can install inf-ruby with the following command:

M-x package-install [RET] inf-ruby [RET]

or by adding this bit of Emacs Lisp code to your Emacs initialization file (.emacs or init.el):

(unless (package-installed-p 'inf-ruby)
  (package-install 'inf-ruby))

If the installation doesn't work try refreshing the package list:

M-x package-refresh-contents [RET]

Via el-get

el-get is another popular package manager for Emacs. If you're an el-get user just do M-x el-get-install.

Manual

If you're installing manually, you'll need to:

  • drop the inf-ruby.el file somewhere on your load path (perhaps ~/.emacs.d/vendor)
  • Add the following lines to your .emacs (or init.el) file:
(autoload 'inf-ruby-minor-mode "inf-ruby" "Run an inferior Ruby process" t)
(add-hook 'ruby-mode-hook 'inf-ruby-minor-mode)

Or, for enh-ruby-mode:

(add-hook 'enh-ruby-mode-hook 'inf-ruby-minor-mode)

Installation via package.el interface does the above for you automatically.

Additionally, consider adding

(add-hook 'after-init-hook 'inf-ruby-switch-setup)

to your init file to easily switch from common Ruby compilation modes to interact with a debugger.

Emacs Prelude

inf-ruby comes bundled in Emacs Prelude. If you're a Prelude user you can start using it right away.

Usage

A simple IRB process can be fired up with M-x inf-ruby.

To launch a REPL with project-specific console instead, type M-x inf-ruby-console-auto. It recognizes several project types, including Rails, gems and anything with racksh in their Gemfile.

Customization: When entered, this mode runs comint-mode-hook and inf-ruby-mode-hook (in that order).

You can send text to the inferior Ruby process from other buffers containing Ruby source.

  • ruby-switch-to-inf switches the current buffer to the ruby process buffer.
  • ruby-send-definition sends the current definition to the ruby process.
  • ruby-send-region sends the current region to the ruby process.
  • ruby-send-definition-and-go and ruby-send-region-and-go switch to the ruby process buffer after sending their text.

Commands:

  • RET after the end of the process' output sends the text from the end of process to point.
  • RET before the end of the process' output copies the sexp ending at point to the end of the process' output, and sends it.
  • DEL converts tabs to spaces as it moves back.
  • TAB completes the input at point. IRB, Pry and Bond completion is supported.
  • C-M-q does TAB on each line starting within following expression.
  • Paragraphs are separated only by blank lines. # start comments.
  • If you accidentally suspend your process, use comint-continue-subjob to continue it.

Keymap

To see the list of the keybindings defined by inf-ruby-minor-mode, type M-x describe-function [RET] inf-ruby-minor-mode [RET].

inf-ruby's People

Contributors

dgutov avatar nonsequitur avatar abicky avatar drjkl avatar hrvladev avatar jgrimes avatar lewang avatar avsej avatar purcell avatar seisuke avatar

Watchers

 avatar James Cloos 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.