MacOS – Sending ctrl+function key on iTerm2

itermkeyboardmacos

Byobu has some keybindings that require a modifier key and a function key, like Shift+f2 or Ctrl+f7. Unfortunately macOS picks these up instead and does god knows what with them. How do I send these key combinations to iTerm2?

Best Answer

I had exactly the same issue and it seems to have been solved in the latest iTerm2. But if your profile was created before the fix like mine, a little configuration is needed:

  1. Go to Preferences -> Profiles -> <Your Profile> -> Terminal, make sure 'Report terminal type' is set to xterm-256color (or xterm)
  2. Go to Preferences -> Profiles -> <Your Profile> -> Keys, click Presets -> xterm Defaults

And then you can see ^F1 ... ^F12 being correctly mapped: iTerm2 key mappings