From: Chad Perrin Date: 2011-04-14T04:44:15+09:00 Subject: Re: Ruby for beginners (was: Re: Hello) --E7i4zwmWs5DOuDSH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 13, 2011 at 06:08:08PM +0900, Phillip Gawlowski wrote: > On Wed, Apr 13, 2011 at 5:23 AM, Stu wrote: > > 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 o= ther > > cli editors( emacs, pico/nano, and even ed for those still <3 the origi= nal > > unix line editor) >=20 > CLI editors are great -- for advanced users. >=20 > 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'] =3D 'xedit' =3D> "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'] =3D '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. >=20 > (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. --=20 Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ] --E7i4zwmWs5DOuDSH Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk2l+gkACgkQ9mn/Pj01uKV08ACfcbpavsohW39lZK6jU+qYWyvp sQkAoPycsF891QHuD1ZAE/hH8BevhA9j =4ZJP -----END PGP SIGNATURE----- --E7i4zwmWs5DOuDSH--