Skip to content
John Mair edited this page Jun 28, 2011 · 27 revisions

Editor integration

Overview

Although Pry has reasonable support for editing and modifying code, its functionality in this regard cannot compare to a bona fide editor. As a result Pry has fairly good editor integration to give you the best of both worlds.

Invoking an editor through the shell

This is the simplest way to start an editor from Pry. As stated in the shell integration section any input prefixed by a . is sent to the shell; so one way to open an editor in Pry is just to enter the name of the editor prefixed by a ..

Example:

pry(main)> .vim test_file.rb

Example: Interpolate file name

pry(main)> stat Grit.log
Method Information:
--
Name: Grit.log
Owner: #<Class:Grit>
Type: Bound
Arity: 1
Method Signature: log(str)
pry(main)> .emacsclient #{_file_}

** Setting the editor**

Opening an editor

Using shell integration any editor can easily be opened from a REPL session; simply

**

Clone this wiki locally