On my Debian systems, I have always used pdksh as my interactive shell. Originally, command-line history behavior was similar to what I grew up with on platforms like AIX and Solaris.
Recently, since pdksh on Debian is now implemented by mksh, command-line history no longer works like my fingers expect. I am trying to figure out if I can configure mksh to do what I want, or if I have to find another idiom (or another shell).
I use ksh in vi-editing mode (set -o vi and FCEDIT=vi). Quite often, I write short multi-line commands immediately at the command prompt, i.e.
daystrom:/home/pronovic> for i in 1 2 3
> do
> print $i
> done
1
2
3
These work as expected in mksh. However, command-line history does not.
In all of the kshell implementations that I am familiar with (prior to now), this script would be preserved in the history as a single entry. So, I could hit ESC-k and go back to the front of the for line. Once I got there, I could edit the script in place again, or I could hit ESC-v to edit the script in vi.
In mksh, each line in my script (the for line, the do line, the print line, etc.) ends up as a separate entry in my history. So, ESC-k just takes me to the done line, ESC-k again takes me to the print line, etc.
I am looking for a way to configure mksh so ESC-k takes me to the beginning of my script so I can execute it or edit it again. However, I haven't found a way to do this.
The only discussion I have found is on gmane, which implies that ^O can somehow be used. However, it's not clear to me how that is relevant -- or maybe it's just not relevant in vi-editing mode.
Is it possible to make this work?