Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: HPUX (was Re: vi command line editing)
- X-seq: zsh-users 1425
- From: Dan Nelson <dnelson@xxxxxxxxxxxx>
- To: Andrew Main <zefram@xxxxxxxxx>, Shawn Leas <sleas@xxxxxxxxxxxxxxxxxxxxxx>
- Subject: Re: HPUX (was Re: vi command line editing)
- Date: Wed, 25 Mar 1998 10:01:50 -0600
- Cc: thomas@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, zsh-users@xxxxxxxxxxxxxxx
- In-reply-to: <199803251022.KAA30301@xxxxxxxxxxxxxxxx>; from "Andrew Main" on Wed Mar 25 10:22:49 GMT 1998
- References: <Pine.HPP.3.96.980324160001.1246A-100000@xxxxxxxxxxxxxxxxxxxxxx> <199803251022.KAA30301@xxxxxxxxxxxxxxxx>
In the last episode (Mar 25), Andrew Main said:
> Shawn Leas wrote:
> >bindkey -s "^[OA" "^[ka"
> >bindkey -s "^[OB" "^[ja"
> >bindkey -s "^[OD" "^[ha"
> >bindkey -s "^[OC" "^[la"
>
> That's a terminal issue. Some terminals send "^[OA" instead of "^[[A".
> Of course, a lot of terminals send sequences completely different from
> these, but zsh should probably recognise both of these sets by default.
My soution (adjust to your needs):
# usage: bindtc <cap> <default> <zsh-command>
# Binds a termcap entry <cap> to a command. If the termcap string does
# not exist, use <default>
bindtc ()
{
local keyval=$(echotc "$1" 2>&-)
bindkey "${keyval:-$2}" "$3"
}
# Bindings for UP, DOWN, LEFT, RIGHT
bindtc ku "^[[A" up-line-or-history
bindtc kd "^[[B" down-line-or-history
bindtc kr "^[[C" forward-char
bindtc kl "^[[D" backward-char
-Dan Nelson
dnelson@xxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author