Pasting code with tab indentation to irb

Discussion in 'Ruby' started by benny, May 26, 2005.

  1. benny

    benny Guest

    dear list,

    I want to be able to copy/paste code with tab indentation to irb, but I
    don't know how to setup irb for this.

    I am aware of

    require 'irb/completion'

    in the .irbrc taking the tab completition away from the shell and
    making its own tab completition.

    So maybe I may overwrite some method in irb/ irb/completition to prevent
    irb tab completition and shell/bash tab completition.

    I tried to figure it out on my own but didn't succeed.

    Any hints? (Please no discussion about tab indentation vs. space indentation
    here :) )


    benny
    benny, May 26, 2005
    #1
    1. Advertising

  2. benny

    Mark Hubbart Guest

    On 5/26/05, benny <> wrote:
    > dear list,
    >=20
    > I want to be able to copy/paste code with tab indentation to irb, but I
    > don't know how to setup irb for this.
    >=20
    > I am aware of
    >=20
    > require 'irb/completion'
    >=20
    > in the .irbrc taking the tab completition away from the shell and
    > making its own tab completition.
    >=20
    > So maybe I may overwrite some method in irb/ irb/completition to prevent
    > irb tab completition and shell/bash tab completition.
    >=20
    > I tried to figure it out on my own but didn't succeed.
    >=20
    > Any hints? (Please no discussion about tab indentation vs. space indentat=

    ion
    > here :) )


    You could assign a new input method to IRB.CurrentContext.io:
    IRB.CurrentContext.io =3D IRB::StdioInputMethod.new

    Write a short-named method that toggles the input method between
    IRB::StdioInputMethod and IRB::ReadlineInputMethod, and you can
    quickly switch between the two modes.

    cheers,
    Mark
    Mark Hubbart, May 26, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Moritz Bunkus
    Replies:
    4
    Views:
    266
    Moritz Bunkus
    Jun 17, 2004
  2. Ben

    Pasting strings into irb

    Ben, Mar 3, 2005, in forum: Ruby
    Replies:
    8
    Views:
    401
    Martin DeMello
    Mar 8, 2005
  3. aidy
    Replies:
    5
    Views:
    85
    Mobody hackely
    Apr 22, 2006
  4. Iñaki Baz Castillo

    Does YAML allow TAB for indentation?

    Iñaki Baz Castillo, Apr 5, 2008, in forum: Ruby
    Replies:
    3
    Views:
    101
    Iñaki Baz Castillo
    Apr 5, 2008
  5. Jesse B.
    Replies:
    2
    Views:
    181
    Josh Cheek
    Mar 27, 2010
Loading...

Share This Page