Re: ksh: allow editing empty line with 'v' in vi-mode

Johannes Thyssen Tishman <[email protected]> Fri, 31 Jul 2026 20:17:21 +0000
Newsgroups gmane.os.openbsd.tech
Message-ID <[email protected]>
2026-07-31T08:51:14-0600 Andy Bradford <[email protected]>:
> Thus said Johannes Thyssen Tishman on Fri, 31 Jul 2026 09:26:12 -0000:
> 
> > This  is only  possible if  HISTCONTROL doesn't  include 'ignorespace'
> > (see my reply to Uwe). While I  could simply remove that option and do
> > as  you suggest,  I  think  that allowing  ^[v  in  empty lines  *and*
> > ignoring white-space only commands is a valid use case.
> 
> I didn't  realize that  HISTCONTROL impacted  this. Thanks  for pointing
> this out.
> 
> I too think that it's a valid use  case if it can be distinguished to be
> intentional by the  user. My only concern is that  it introduces another
> potential misbehavior or at least surprising behavior. If my terminal is
> already in command  mode and I want  to type a command  beginning with v
> (like vacation, vi, vipw, view), will I accidentally get thrown into the
> vi editor,  when what  I really  wanted was  to just  type one  of those
> commands?

Yes. But by that logic, you could also, for some reason, forget that you
are in command mode while editing a command and press 'dd'. I'd argue
that this patch improves consistency and doesn't introduce a
misbehaviour, because with it, ^[v works regardless of the state of
command line.

> Right now what happens is that I get a bell (visual or audio), letting
> me know that I'm not in edit mode. Or does the suggested patch imply
> that it would only enter vi mode upon receiving  both ^[v in some
> duration of time, e.g. after 250ms if no v is observed  after the ^[
> do not permit the v to enter edit mode?

No, there is no timeout.