3

When I'm pressing the function keys, for example F12, I get a tilde symbol on my cursor position (~ sign). How can I turn this of ? This issue affects both shells, Bash and the Zsh.

What dotfiles should I paste ?

asked Dec 25, 2010 at 18:55

2 Answers 2

2

On bash from version 4.1, you can stop that from happening by sticking this into ~/.inputrc:

"\e[": skip-csi-sequence

That will make it ignore any keycode that isn't bound to anything else.

answered Dec 25, 2010 at 19:22
2

You can assign something to each of those keys. You can also assign a null string.

To find out the sequence emitted by each key, press Ctrl-v then the function key. On my system, for F12, I see ^[[24~. The "^[" represents Escape which will be represented by \e in the lines below.

In Bash, in your ~/.inputrc file, add lines like this:

"\e[24~": ""

or, if you want to make it output something:

"\e[24~": "Super User"

which will make the corresponding key do nothing.

In Z shell, you can add bindkey commands to your ~/.zshrc file like this:

bindkey -s "\e[24~" ""

or, if you want to make it output something:

bindkey -s "\e[24~" "Super User"
answered Dec 27, 2010 at 1:29
2
  • I believe the trailing ~ is being inserted by your shell, after the ctrl-v sequence executes, and will therefore not register correctly with keybind -- "\e[24~" should read "\e[24" Commented Feb 8, 2019 at 21:34
  • @AdamTolley: That is incorrect. Where would the shell get the idea that it should output a tilde? Can you show any evidence that your assertion is true? As counter evidence, I tried the sequence Ctrl-V F12 in: Bash, dash, ksh, zsh shells and in Gnome, xterm and terminator terminals under Ubuntu 18.04 and in all cases the tilde was output. It even worked similarly on a MacBook Pro in Bash in Terminal using Ctrl-V Fn-F6 (F12 changes to the widget screen). Commented Feb 8, 2019 at 22:13

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.