Re: asigning a certain command to a certain keyboard key

From: John Green (greenjh_at_hotmail.com)
Date: 11/23/03


Date: 23 Nov 2003 06:25:32 -0800


>
> This topic came up in Debian a year or two ago. My suggested solution was
> to generate bindings for the normal mode based on the application mode.
> In zsh, that turned out to be relatively simple. (I haven't noticed any
> comments that indicate bash users have adapted this approach).
>

OK, I'll take the bait ;-)
Using bash 2.05b in an xterm under Mandrake Linux 8.2.

As an experiment, I tried to make the F1 key
execute a clear command. The Ctrl-V trick
showed that F1 generates ^[OP

I tried lots of different bind commands, which were accepted without
protest. However, pressing F1 at the command prompt afterwards
just gives this error.

bash_execute_unix_command: cannot find keymap for command

I googled for this message with no helpful results.

Here are some of my attempts to remap the F1 key.

bind -x '"\C-[OP": clear'
bind -x '"\C-[OP":clear'
bind -x '"\C-[OP": /usr/bin/clear'
bind -m emacs -x '"\C-[OP": clear'
bind -m emacs-standard -x '"\C-[OP":clear'

These do *something*, because pressing F1 did not give any
error messages before - it just output 0.

This isn't merely an experiment: some of my laptop's keys
are dead and it would be good to remap function keys instead.
I guess I should edit /etc/inputrc, but I'd really like to
see things work from the command-line first.

Anyone know what I am doing wrong?

PS, I tried bind -v on a linux virtual terminal without X.
The F1 key returns the code ^[[[A, which translates into

bind -x '"\C-[[[A": clear'

The result is the same error message when F1 is
pressed afterwards.

John Green


Loading