ARCHIVED: In xterm, how are the VT100 PF keys mapped onto the function keys?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

In xterm, you can redefine any key. Most X servers understand how to intercept the function, or F keys. If you want to set an xterm function key to send a particular string, add a line using the format below to your .Xresources file:

  *VT100.Translations:  #override <Key>F?:  string("whatever") \n

Replace ? in the above example with a number between 1 and 10, representing one of the F1 through F10 keys, and replace whatever with the string you want that key to send.

For example, the string which represents the PF1 key on the VT100 keyboard is <ESC>OP ("O" and "P" are uppercase). So, to cause the F1 key to send a PF1 character sequence, add this line to your .Xresources file:

  *VT100.Translations:  #override <Key>F1:  string("^[OP") \n

The ^[ above represents an Esc character. See your editor's documentation for information on how to insert this special character.

Similarly, for binding the F2 key to PF2, the F3 key to PF3, and the F4 key to PF4 respectively, you must add the following lines to your .Xresources file:

  *VT100.Translations:  #override <Key>F2:  string("^[OQ") \n
  *VT100.Translations:  #override <Key>F3:  string("^[OR") \n
  *VT100.Translations:  #override <Key>F4:  string("^[OS") \n

After doing this, in order to let your X server know what the new defaults are, type:

  xrdb < .Xresources

xrdb is invoked when you start your X server.

At Indiana University, for personal or departmental Linux or Unix systems support, see Get help for Linux or Unix at IU.

This is document abko in the Knowledge Base.
Last modified on 2018-01-18 08:44:08.

Contact us

For help or to comment, email the UITS Support Center.