Sending ctrl+function key on iTerm2

Solution 1:

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

Solution 2:

You can disable shortcuts used by MacOS. To do this:

  • Open System Preferences (under the Apple menu)
  • Select Keyboard
  • Click Shortcuts

Here you'll see several sets of shortcuts you can toggle. The two lists you'll want to look at are Mission Control and Keyboard. Uncheck anything that uses a function key. Your various function keys should now work inside Byobu.

Notes:

You can change whether you have to hold Fn to use a function key. Under the Keyboard tab, check "Use F1, F2, etc. keys as standard function keys."

While you're in the shortcuts tab, you might scroll around and see what other shortcuts MacOS has to offer. You might see something useful to you or notice another keyboard shortcut that's been getting in your way.