On Thu, Mar 10, 2005 at 03:28:47AM +0900, Joel VanderWerf wrote:
> >* support for bash-style multiline editing (multiline commands are
> >stored in one history entry)
> 
> I've wanted this for a long time! (Stupid me, I thought zsh was the only 
> shell with multiline editing.)

I wrote "bash style", which is not the same as "zsh style". 

According to my classification, there are three type of multiline
editing models (actual keymaps are irrelevant as far as the
classification goes, of course):

 * bash style: after entering a multiline command, the up arrow (or
 ctrl-p) brings back the whole multiline command in one. Then it behaves
 as one long line, you can move left and right within the line.

 * zsh style: after entering a multiline command, the up arrow (or
 ctrl-p) brings back the whole multiline command in one. Then it behaves
 as an array of lines, up/down arrow moves between the lines, and
 left/right arrow moves within a line. As I know, there is no way to go
 back in one step from one multiline block to the other, you have to
 climb up linewise. While in general it's better than bash style, this
 latter behaviour could be quite painful after a ten line class
 definition. Maybe not an issue for a shell, but is an issue for irb.

 * pyrepl style:  after entering a multiline command, ctrl-p
 brings back the whole multiline command in one, Then it behaves as an
 array of lines, up/down arrow moves between the lines, and left/right
 arrow moves within a line. Hitting ctrl-p/ctrl-n always moves between
 multiline blocks.

So the most advanced model is that of pyrepl. Tell me if I missed
something and these things are also possible in zsh (or bash).

By the way, if you don't know what pyrepl is: it's mwh's excellent
readline-a-like in python. Worth to check out, at least to play with
these features (but if I happen to do something with python, I can't
imagine that without pyrepl -- you can imagine, getting multiline
editing right is much more an issue with python than with everything
else). You find it at http://codespeak.net/pyrepl/, just unpack the
tarball, cd into the top dir, and type "python pythoni".

My idea is that pyrepl should be ported to ruby eventually. Not only it
has the mentioned features, but then we would have a totally accessible
and controllable access to readline functionality in pure ruby, and one
wouldn't need to meditate which other parts of readline should have a ruby
binding for being able to implement this idea or that.

Csaba