From: Scott Bass on
Hi,

My environment is ksh88 (ugh!) under HP-UX, with Putty as my
connection client.

I'm trying to remap my arrow, home, and end keys to the emacs editing
mode key sequences.

I've got the arrow keys working thanks to Google:

# vt100 normal (non-application) cursor keys
# alias -x __A=$(print '\020') # Set the up arrow to Ctrl-P (previous
command)
# alias -x __B=$(print '\016') # Set the down arrow to Ctrl-N (next
command)
# alias -x __C=$(print '\006') # Set the right arrow to Ctrl-F (move
forward)
# alias -x __D=$(print '\002') # Set the left arrow to Ctrl-B (move
backwards)

# Home and End for typical vt100 emulations
# (this doesn't work, I can't find the key codes for Home and End. Oh
well...)
# alias -x __F=$(print '\001') # Set the home key to Ctrl-A (start of
command)
# alias -x __K=$(print '\005') # Set the end key to Ctrl-E (end of
command)

alias __A=$(print '\0020') # ^P = up = previous command
alias __B=$(print '\0016') # ^N = down = next command
alias __C=$(print '\0006') # ^F = right = forward a character
alias __D=$(print '\0002') # ^B = left = back a character
alias __H=$(print '\0001') # ^A = home = beginning of line
alias __W=$(print '\0005') # ^E = end = end of line

The Putty help page says:

4.4.2 Changing the action of the Home and End keys
The Unix terminal emulator rxvt disagrees with the rest of the world
about what character sequences should be sent to the server by the
Home and End keys.

xterm, and other terminals, send ESC [1~ for the Home key, and ESC [4~
for the End key. rxvt sends ESC [H for the Home key and ESC [Ow for
the End key.

If you find an application on which the Home and End keys aren't
working, you could try switching this option to see if it helps.

If my Putty setting is set to xterm, neither Home nor End work - both
just cause the bell sound (from the ESC [1 and ESC [4 sequence???) and
display ~ in the terminal.

If my Putty setting is set to rxvt, Home works - the alias defined
above causes the the cursor to move to the beginning of the line. But
End causes the bell sound, and displays w in the terminal.

The arrow keys work in both settings.

Questions:

1) How can I get the End key to move to the end of line? IOW, I need
to alias the key sequence (either ESC [4~ or ESC [0w) to Cntl-E.

2) Where can I find documentation for the syntax in the aliases found
via Google? IOW I'd like more details on the "__A", "__B", etc. and
the $(print '\0020'), etc. syntax in the above aliases. If it's in
the man pages I can't find it. A good web page documenting this would
be fantastic.

Thanks for the help,
Scott
From: Scott Bass on
Surely this is documented somewhere???

On Mar 11, 6:42 am, Scott Bass <sas_l_...(a)yahoo.com.au> wrote:
> Hi,
>
> My environment is ksh88 (ugh!) under HP-UX, with Putty as my
> connection client.
>
> I'm trying to remap my arrow, home, and end keys to the emacs editing
> mode key sequences.
>
> I've got the arrow keys working thanks to Google:
>
> # vt100 normal (non-application) cursor keys
> # alias -x __A=$(print '\020')  # Set the up arrow to Ctrl-P (previous
> command)
> # alias -x __B=$(print '\016')  # Set the down arrow to Ctrl-N (next
> command)
> # alias -x __C=$(print '\006')  # Set the right arrow to Ctrl-F (move
> forward)
> # alias -x __D=$(print '\002')  # Set the left arrow to Ctrl-B (move
> backwards)
>
> # Home and End for typical vt100 emulations
> # (this doesn't work, I can't find the key codes for Home and End.  Oh
> well...)
> # alias -x __F=$(print '\001')  # Set the home key to Ctrl-A (start of
> command)
> # alias -x __K=$(print '\005')  # Set the end key to Ctrl-E (end of
> command)
>
> alias __A=$(print '\0020')    # ^P = up    = previous command
> alias __B=$(print '\0016')    # ^N = down  = next command
> alias __C=$(print '\0006')    # ^F = right = forward a character
> alias __D=$(print '\0002')    # ^B = left  = back a character
> alias __H=$(print '\0001')    # ^A = home  = beginning of line
> alias __W=$(print '\0005')    # ^E = end   = end of line
>
> The Putty help page says:
>
> 4.4.2 Changing the action of the Home and End keys
> The Unix terminal emulator rxvt disagrees with the rest of the world
> about what character sequences should be sent to the server by the
> Home and End keys.
>
> xterm, and other terminals, send ESC [1~ for the Home key, and ESC [4~
> for the End key. rxvt sends ESC [H for the Home key and ESC [Ow for
> the End key.
>
> If you find an application on which the Home and End keys aren't
> working, you could try switching this option to see if it helps.
>
> If my Putty setting is set to xterm, neither Home nor End work - both
> just cause the bell sound (from the ESC [1 and ESC [4 sequence???) and
> display ~ in the terminal.
>
> If my Putty setting is set to rxvt, Home works - the alias defined
> above causes the the cursor to move to the beginning of the line.  But
> End causes the bell sound, and displays w in the terminal.
>
> The arrow keys work in both settings.
>
> Questions:
>
> 1)  How can I get the End key to move to the end of line?  IOW, I need
> to alias the key sequence (either ESC [4~ or ESC [0w) to Cntl-E.
>
> 2)  Where can I find documentation for the syntax in the aliases found
> via Google?  IOW I'd like more details on the "__A", "__B", etc. and
> the $(print '\0020'), etc. syntax in the above aliases.  If it's in
> the man pages I can't find it.  A good web page documenting this would
> be fantastic.
>
> Thanks for the help,
> Scott

From: Scott Bass on
Surely this is documented somewhere???

On Mar 11, 6:42 am, Scott Bass <sas_l_...(a)yahoo.com.au> wrote:
> Hi,
>
> My environment is ksh88 (ugh!) under HP-UX, with Putty as my
> connection client.
>
> I'm trying to remap my arrow, home, and end keys to the emacs editing
> mode key sequences.
>
> I've got the arrow keys working thanks to Google:
>
> # vt100 normal (non-application) cursor keys
> # alias -x __A=$(print '\020')  # Set the up arrow to Ctrl-P (previous
> command)
> # alias -x __B=$(print '\016')  # Set the down arrow to Ctrl-N (next
> command)
> # alias -x __C=$(print '\006')  # Set the right arrow to Ctrl-F (move
> forward)
> # alias -x __D=$(print '\002')  # Set the left arrow to Ctrl-B (move
> backwards)
>
> # Home and End for typical vt100 emulations
> # (this doesn't work, I can't find the key codes for Home and End.  Oh
> well...)
> # alias -x __F=$(print '\001')  # Set the home key to Ctrl-A (start of
> command)
> # alias -x __K=$(print '\005')  # Set the end key to Ctrl-E (end of
> command)
>
> alias __A=$(print '\0020')    # ^P = up    = previous command
> alias __B=$(print '\0016')    # ^N = down  = next command
> alias __C=$(print '\0006')    # ^F = right = forward a character
> alias __D=$(print '\0002')    # ^B = left  = back a character
> alias __H=$(print '\0001')    # ^A = home  = beginning of line
> alias __W=$(print '\0005')    # ^E = end   = end of line
>
> The Putty help page says:
>
> 4.4.2 Changing the action of the Home and End keys
> The Unix terminal emulator rxvt disagrees with the rest of the world
> about what character sequences should be sent to the server by the
> Home and End keys.
>
> xterm, and other terminals, send ESC [1~ for the Home key, and ESC [4~
> for the End key. rxvt sends ESC [H for the Home key and ESC [Ow for
> the End key.
>
> If you find an application on which the Home and End keys aren't
> working, you could try switching this option to see if it helps.
>
> If my Putty setting is set to xterm, neither Home nor End work - both
> just cause the bell sound (from the ESC [1 and ESC [4 sequence???) and
> display ~ in the terminal.
>
> If my Putty setting is set to rxvt, Home works - the alias defined
> above causes the the cursor to move to the beginning of the line.  But
> End causes the bell sound, and displays w in the terminal.
>
> The arrow keys work in both settings.
>
> Questions:
>
> 1)  How can I get the End key to move to the end of line?  IOW, I need
> to alias the key sequence (either ESC [4~ or ESC [0w) to Cntl-E.
>
> 2)  Where can I find documentation for the syntax in the aliases found
> via Google?  IOW I'd like more details on the "__A", "__B", etc. and
> the $(print '\0020'), etc. syntax in the above aliases.  If it's in
> the man pages I can't find it.  A good web page documenting this would
> be fantastic.
>
> Thanks for the help,
> Scott

From: projXYZZYtools on
On 10 mar, 20:42, Scott Bass <sas_l_...(a)yahoo.com.au> wrote:
> Hi,
>
> My environment is ksh88 (ugh!) under HP-UX, with Putty as my
> connection client.
>
> I'm trying to remap my arrow, home, and end keys to the emacs editing
> mode key sequences.
>
> I've got the arrow keys working thanks to Google:
>
> # vt100 normal (non-application) cursor keys
> # alias -x __A=$(print '\020')  # Set the up arrow to Ctrl-P (previous
> command)
> # alias -x __B=$(print '\016')  # Set the down arrow to Ctrl-N (next
> command)
> # alias -x __C=$(print '\006')  # Set the right arrow to Ctrl-F (move
> forward)
> # alias -x __D=$(print '\002')  # Set the left arrow to Ctrl-B (move
> backwards)
>
> # Home and End for typical vt100 emulations
> # (this doesn't work, I can't find the key codes for Home and End.  Oh
> well...)
> # alias -x __F=$(print '\001')  # Set the home key to Ctrl-A (start of
> command)
> # alias -x __K=$(print '\005')  # Set the end key to Ctrl-E (end of
> command)
>
> alias __A=$(print '\0020')    # ^P = up    = previous command
> alias __B=$(print '\0016')    # ^N = down  = next command
> alias __C=$(print '\0006')    # ^F = right = forward a character
> alias __D=$(print '\0002')    # ^B = left  = back a character
> alias __H=$(print '\0001')    # ^A = home  = beginning of line
> alias __W=$(print '\0005')    # ^E = end   = end of line
>
> The Putty help page says:
>
> 4.4.2 Changing the action of the Home and End keys
> The Unix terminal emulator rxvt disagrees with the rest of the world
> about what character sequences should be sent to the server by the
> Home and End keys.
>
> xterm, and other terminals, send ESC [1~ for the Home key, and ESC [4~
> for the End key. rxvt sends ESC [H for the Home key and ESC [Ow for
> the End key.
>
> If you find an application on which the Home and End keys aren't
> working, you could try switching this option to see if it helps.
>
> If my Putty setting is set to xterm, neither Home nor End work - both
> just cause the bell sound (from the ESC [1 and ESC [4 sequence???) and
> display ~ in the terminal.
>
> If my Putty setting is set to rxvt, Home works - the alias defined
> above causes the the cursor to move to the beginning of the line.  But
> End causes the bell sound, and displays w in the terminal.
>
> The arrow keys work in both settings.
>
> Questions:
>
> 1)  How can I get the End key to move to the end of line?  IOW, I need
> to alias the key sequence (either ESC [4~ or ESC [0w) to Cntl-E.
>
> 2)  Where can I find documentation for the syntax in the aliases found
> via Google?  IOW I'd like more details on the "__A", "__B", etc. and
> the $(print '\0020'), etc. syntax in the above aliases.  If it's in
> the man pages I can't find it.  A good web page documenting this would
> be fantastic.
>
> Thanks for the help,
> Scott

1)

From my own experience : you can't.
You can switch to the bash shell if it is available on your system: it
recognizes any keys combination.


ksh88 is only able to recognize "ESC letter" or "ESC [ letter"
sequences.

ksh93 may recognize any key sequence but, after a long work on it, I
wasn't able to manage it to work.


2)

The documentation about the aliases __A, __B *is* in the man pages !

http://www2.research.att.com/sw/download/man/man1/ksh88.html

But very difficult to find !



It's in "Emacs Editing Mode" part:

---------------------------------

M-[letter
Soft-key - Your alias list is searched for an alias by the name
__letter and if an alias of this name is defined, its value will be
inserted on the input queue. The can be used to program functions keys
on many terminals.

---------------------------------


N.B. :
Use the od command to dump the sequences sent by the keys :

After validating "od -cx" command line, I hit
[Home][Return]
[End] [Return]
[Ctrl][D] (to exit "o" command)



$ od -cx
^[[1~
^[[4~
0000000 033 [ 1 ~ \n 033 [ 4 ~ \n
5b1b 7e31 1b0a 345b 0a7e
0000012