0

I want to remap my F9 key to the dollar sign ($) symbol.

So I ran this command

bind '"\e[20": "$"'

Now whenever I type the F9 key, instead of getting just

$

I get

$~

Why is the extra tilde there and how can I get rid of it?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
  • `F9` is `\e[20~` for me. That's probably where the `~` comes from. Press Ctrl-V and then F9. What do you get? – muru Dec 15 '16 at 09:00

1 Answers1

1

Try this:

bind '"\e[20~": "$"'

To determine character sequence for a key press,

  • Press Ctrl+v and press the key for which you want to get the character sequence.

Example:

For key F9, I get ^[[20~ where ^[ is Esc key and remaining sequence is for F9.

Thushi
  • 9,388
  • 4
  • 29
  • 43
  • Thanks! That did the trick. For me Ctrl+v does not work but I was able to get the keycode using the method described [here](http://unix.stackexchange.com/questions/76566/where-do-i-find-a-list-of-terminal-key-codes-to-remap-shortcuts-in-bash) – Guillaume Perrault-Archambault Dec 15 '16 at 23:14