This is a request for explanation or pointer to documentation.
I'm a KornShell93 (ksh on Mac OS X or ksh93 elsewhere) user. I like the shell for its relative simplicity as an interactive shell and for its scripting capabilities, and I've been using it since the code was made more free in 2000. I use it in vi editing mode, with both the vi and viraw options set.
There's a neat feature in ksh93 that allows you to start typing a command on the command line and then press Up-arrow to get the latest matching command line out of the command line history. I can find the documentation for this and how it's bound to [count][A in vi editing mode, no problem.
However, if I press Up-arrow at an empty prompt, it first gives me the most recently executed command, then it starts cycling through whatever command prefix I had previously looked for. This annoys me no ends.
Example:
I execute these three commands:
$ ls -l
$ ls -ld test
$ ls -ld testdir
Typing ls and then pressing Up-arrow three times will cycle through them in opposite order.
Later, with many more commands issued, but no history searches and no ls invocations:
$ cc -o testrun mytest.c
$ man strncmp
If I now press Up-arrow once, I get man strncmp. If I press Up-arrow again, I get ls -ld testdir and then ls -ld test rather than the command cc -o testrun mytest.c and then the previous before that.
I'm looking for pointers for how to "fix" this so that Up-arrow without typing anything on the command line beforehand cycles through the most recent history without trying search for a previously used prefix. Even a pointer to somewhere where the behaviour above is documented would be nice.
EDIT:
The ksh93 manual says
[count]kFetch previous command. Each timekis entered the previous command back in time is accessed.
/stringSearch backward through history for a previous command containingstring.Stringis terminated by aRETURNorNEW LINE. Ifstringis preceded by a^, the matched line must begin withstring. Ifstringis null, the previousstringwill be used.
[count][AIf cursor is at the end of the line it is equivalent to/withstringset to the contents of the current line. Otherwise, it is equivalent tok.
This does not explain why I first get man strncmp (as if pressing k) and then get ls -ld testdir in my example above. With the text of the manual in mind, I would expect to get ls -ld testdir on the first press of Up-arrow (which would be even more annoying, by the way).
ksh93that you're using.[ESC] [k] [k] ...scrolls back through history until you hit the top.