Re: xmodmap, readline, and ye olde meta key
Re: xmodmap, readline, and ye olde meta key
- Subject: Re: xmodmap, readline, and ye olde meta key
- From: Jeremy Huddleston <email@hidden>
- Date: Fri, 31 Dec 2010 12:25:14 -0800
On Dec 31, 2010, at 04:34, Richard Cobbe wrote:
> On Fri, Dec 31, 2010 at 12:33:30AM -0500, James K. Lowden wrote:
>> Greetings,
>>
>> I got a brand new MacBook Pro running 10.6.5 for Christmas. I'm having a
>> little trouble understanding how X and xterms are initialized, and what I
>> can and can't expect to work. My search of this list's archives finds
>> many references to readline, but most of them seem to have to do with
>> emacs or some Java thing.
>>
>> My issue is with bash. Specifically, I'd like:
>>
>> 1. move-by-word to work by pressing alt-f and alt-b
>
> If by "alt" you mean "command", then this works right out of the box (but
> see below). If by "alt" you mean "option", then additional effort is
> necessary. I don't know that I agree with Jeremy that .inputrc is the
> right place to do this
Because that's exactly the place as defined by readline(3)'s INITIALIZATION FILE section. From radline(3):
forward-word (M-f)
Move forward to the end of the next word. Words are composed of alphanumeric characters (let-
ters and digits).
backward-word (M-b)
Move back to the start of the current or previous word. Words are composed of alphanumeric
characters (letters and digits).
I use meta-forward and meta-backward to move back/forward one word:
"\eOc": forward-word
"\eOd": backward-word
> -- is there a way to modify key bindings in bash
> when running in an xterm but not, for instance, in Terminal.app? I see
> from readline's manpage that you can write conditionals in .inputrc that
> check the value of $TERM, but that's not very robust. In my case, $TERM is
> xterm in an xterm, and xterm-color in Terminal.app, so that's no good.
Well that's what you're limited to. All that bash knows about is TERM. It doesn't know that it's in Terminal.app or xterm.
> For me, command = meta in X clients right out of the box, and I'm pretty
> sure I'm not playing xmodmap games. However, note that if you run a uxterm
> (or otherwise enable utf-8), command is no longer meta.
Sure it is. It's sent as meta to the application (xterm), but its up to the terminal to determine how to send it to the shell. With urxvt, it works for me: meta-forward and meta-back cause the cursor to jump by words.
> I don't have time
> right now to look up the details, but there should be a conversation
> involving me from a couple of years ago in the list archives. Essentially,
> Jeremy said that this was the intended design for X.org -- which is odd,
> because on my Ubuntu desktop at work, xterms are unicode-enabled by
> default, and alt = meta without further configuration. I haven't had time
> to explore this in detail, though, so that's all I know on this point.
Alt mapping to meta was justifiable with 101-key keyboards, and if that is how ubuntu handles 104/5-key keyboards with windows keys, I'd consider that a bug. The "windows key" should be mapped to meta in those cases. Command should be Meta just like it is on real UNIX keyboards (http://en.wikipedia.org/wiki/Meta_key).
Option should map to either Alt or Mode_switch (AltGr). Perhaps a better default would be to use the left alt as Alt and the right one as Mode_switch (http://en.wikipedia.org/wiki/AltGr_key)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden