Re: up/down in pdksh-history with set -o vi

2013-04-12 Thread Christian Weisgerber
Ted Unangst t...@tedunangst.com wrote:

 On the other hand, strictly speaking, vi doesn't support arrow keys.
 vim in compatible mode or the stock vi on hpux (shudder) will just dump
 control characters in your file for example.

Traditional vi does support arrow keys in command mode, just not
in insert mode.

(If you look at the termcap entries for some old terminals, you'll
find that many used ^H for both cursor left and erase.  The only
way to support both is to separate cursor movements and text entry
into different modes.)

-- 
Christian naddy Weisgerber  na...@mips.inka.de



up/down in pdksh-history with set -o vi

2013-04-11 Thread Stefan Olsson
Hello,

I suspect my problem is not entirely OpenBSD-related but more to do with
pdksh and keybindings.

I usually do set -o vi in my .profile. In bash on OS/X it then works to
go up and down in history with both j+k or up+down-keys. If I ssh to a
OpenBSD host from my Mac, I can NOT use up+down in the shell (ksh), but it
works fine in less or vi. It even works fine with up+down keys in bash on
OpenBSD - so what do I need to do in ksh to make up+down-keys work (apart
from doing set -o emacs)??

sturban@LassoLouise:~ $ bind | egrep prefix-2|up-history|down-history
^N = down-history
^P = up-history
^X = prefix-2
^[O = prefix-2
^[[ = prefix-2
^XA = up-history
^XB = down-history

-

TERM=xterm-256color

And yes, I have read this message already:
http://www.mail-archive.com/misc@openbsd.org/msg81796.html

Kind Regards,



Re: up/down in pdksh-history with set -o vi

2013-04-11 Thread Anthony J. Bentley
Stefan Olsson writes:
 Hello,
 
 I suspect my problem is not entirely OpenBSD-related but more to do with
 pdksh and keybindings.
 
 I usually do set -o vi in my .profile. In bash on OS/X it then works to
 go up and down in history with both j+k or up+down-keys. If I ssh to a
 OpenBSD host from my Mac, I can NOT use up+down in the shell (ksh), but it
 works fine in less or vi. It even works fine with up+down keys in bash on
 OpenBSD - so what do I need to do in ksh to make up+down-keys work (apart
 from doing set -o emacs)??
 
 sturban@LassoLouise:~ $ bind | egrep prefix-2|up-history|down-history
 ^N = down-history
 ^P = up-history
 ^X = prefix-2
 ^[O = prefix-2
 ^[[ = prefix-2
 ^XA = up-history
 ^XB = down-history
 
 -
 
 TERM=xterm-256color
 
 And yes, I have read this message already:
 http://www.mail-archive.com/misc@openbsd.org/msg81796.html

I guess it's a bug. See:
http://marc.info/?l=openbsd-miscm=135757054604300w=2



Re: up/down in pdksh-history with set -o vi

2013-04-11 Thread Alexander Polakov
* Stefan Olsson stefan.karl.ols...@gmail.com [130412 03:50]:
 Hello,
 
 I suspect my problem is not entirely OpenBSD-related but more to do with
 pdksh and keybindings.
 
 I usually do set -o vi in my .profile. In bash on OS/X it then works to
 go up and down in history with both j+k or up+down-keys. If I ssh to a
 OpenBSD host from my Mac, I can NOT use up+down in the shell (ksh), but it
 works fine in less or vi. It even works fine with up+down keys in bash on
 OpenBSD - so what do I need to do in ksh to make up+down-keys work (apart
 from doing set -o emacs)??

You can recompile ksh with my unportable hack if you really want to:

http://plhk.ru/trash/ksh/0008-ksh-vi-arrow-keys-support.patch

-- 
Alexander Polakov | plhk.ru



Re: up/down in pdksh-history with set -o vi

2013-04-11 Thread Ted Unangst
On Fri, Apr 12, 2013 at 00:05, Stefan Olsson wrote:

 I usually do set -o vi in my .profile. In bash on OS/X it then works to
 go up and down in history with both j+k or up+down-keys. If I ssh to a
 OpenBSD host from my Mac, I can NOT use up+down in the shell (ksh), but it
 works fine in less or vi. It even works fine with up+down keys in bash on
 OpenBSD - so what do I need to do in ksh to make up+down-keys work (apart
 from doing set -o emacs)??

You fix the code.

I was going to say maybe we just need some default keybindings for vi
mode, but a glance at the code reveals emacs and vi modes are
implemented totally separately. hurray! I suspect somewhere in
ksh/vi.c is a switch statement you could add the magic cases to for
arrow keys.

On the other hand, strictly speaking, vi doesn't support arrow keys.
vim in compatible mode or the stock vi on hpux (shudder) will just dump
control characters in your file for example. If you're going to be
hard core and use vi for command line editing, I'd say you should go
all in and only use hjkl too. :)