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?
3 Answers
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:
- Go to Preferences -> Profiles -> <Your Profile> -> Terminal, make sure 'Report terminal type' is set to
xterm-256color
(orxterm
) - Go to Preferences -> Profiles -> <Your Profile> -> Keys, click Presets -> xterm Defaults
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.
-
Already disabled FN for function keys. It's just annoying. It's also not related to the question. Aug 9, 2017 at 1:16
-
That part was under the Notes section and was intended to provide extra context to other people coming here with the same (or similar) question. The main part of the answer is above the Notes. Were you able to solve your problem by disabling the function key shortcuts? Aug 9, 2017 at 15:02
I have manually configured key mappings on iTerm2 for Byobu, the profile json is available here which you can import and use.
Shift + F2 - Horizontal split
Ctrl + F2 - Vertical split
Shift + Arrow keys - Move across splits
Alt + → or ← - Move across windows
Alt + ↑ or ↓ - Move across sessions
Shift + F11 - Zoom in/out a (split) window