J-Win
J-Win

Reputation: 1502

How to map the alt-keys on the command line

I'm using Cygwin and followed the post at In bash, how do I bind a function key to a command?

I used Ctrl-v to determine the mapping of some keys (e.g. alt-h is ^[h).

As a result, I put "^[h":backward-word in my .inputrc but it doesn't work.

Other mappings for control-keys work, but not for alt-keys.

Upvotes: 5

Views: 1422

Answers (2)

Johnny Wong
Johnny Wong

Reputation: 975

You may also write "\eh": backward-word (in .inputrc), which bind the key Alt-h.

Upvotes: 2

Jack
Jack

Reputation: 6198

Use vi to edit your .inputrc file, and then enter the ^[ character with Ctrl-v[ while in insert mode.

Upvotes: 4

Related Questions