Jeff Schwab
9/16/2006 6:50:00 PM
Marc Heiler wrote:
> Hi,
>
> Is there a way to filter what is typed/copy-pasted in/into IRB?
>
> For example, just for fun and showcasing, to strip any 'a'
> character typed when you are in IRB.
>
> Or, more importantly and main reason to post this, to replace
> leading whitespace + the first '#' char - so that a ruby
> command, that is normally "protected" as a # comment,
> is run instead.
>
> I'd like to have a simple method to toggle between these
> "modes", i.e.
> filter_on
> filter_off
> or similar,
> and then copy paste some lines of codes.
>
> Right now I manually remove the leading #
> and I'd like to let IRB handle this
> rather :)
Warning: This is a complete cop-out, and does not answer your question.
If you're using Vim, you can copy only the columns of text after some
leading characters (e.g. #\s*) by copying only a block selected with
Control-V.