> For what it's worth I have been using interactive_editor gem in irb for a
> bit now. It allows me to open nvi or vim within irb and also supports other
> cli editors( emacs, pico/nano, and even ed for those still <3 the original
> unix line editor)CLI editors are great -- for advanced users.
But the vast majority of people are used to WIMP interfaces, and that's
who should be targeted. vim and EMACS are nice editors, but they
overwhelm non-technically-trained people far too soon.
This is not a problem. Once you have your .irbrc file set up, start irb
and try this:
irb(main):001:0> ENV['EDITOR'] = 'xedit'
=> "xedit"
irb(main):002:0> ed
I use xedit here because it's likely to be just about anywhere people are
using the X Window System. Replace it with gvim, scite, or gedit if you
like. You can also set your EDITOR environment variable in your standard
shell environment (of course), or add the editor setting line above to
your .irbrc file if you like, so that setting up interactive_editor
config in .irbrc looks like this:
require 'rubygems'
require 'interactive_editor'
ENV['EDITOR'] = 'xedit'
Then . . . you just enter "ed" at the irb prompt and it automatically
opens that editor, even if it's a GUI editor. Some editors may benefit
from special command line options.
(How do you generate a random string? Sit down a new student in front
of a vim session.)
How do you generate the complete works of Shakespeare within your
lifetime? Teach your monkeys how to use Vim. (It's not as hard as it
seems, once you get past the initial confusion over modal editing).
Anyway, interactive_editor supports nano "natively" (without the
environment variable trick), which is *really* easy for beginners to
understand. They'll just have to learn to use arrow keys instead of the
mouse.
···
On Wed, Apr 13, 2011 at 06:08:08PM +0900, Phillip Gawlowski wrote:
On Wed, Apr 13, 2011 at 5:23 AM, Stu <stu@rubyprogrammer.net> wrote:
--
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]