12

I am using the latest stable version of iTerm2 (2.0) with the latest Homebrew build of tmux (1.9a). Unfortunately, my keybindings as declared in .tmux.conf do not work with the iTerm2/tmux combo in "integrated mode" (i.e. when iTerm2 takes over the management of tmux windows and panes). I tried different prefixes (C-b, M-a) as well as different key mappings in iTerm, but to no avail.

Is this indeed an iTerm bug? Or is my expectation that the .tmux.conf keybindings would be carried over to iTerm a false one? Even my tmux command prefix (M-a) does not work!

You may view my tmux configuration file at https://gist.github.com/453ab63c42df976bc2be.

BorromeanNot
  • 291
  • 3
  • 7
  • Ever get this one figured out? none of my Tmux keybindings seem to work either. nothing with C-b works. These all work when I'm using the standard Tmux. – dcunited001 Sep 29 '14 at 12:45
  • Actually, it got even worse. Because to my original aporia I must now add a second question: why did this get downvoted earlier? Is the answer too obvious or is the description unclear? I just looked for an answer on the iTerm issues tracker, but no luck. – BorromeanNot Sep 29 '14 at 17:58
  • similar question: https://stackoverflow.com/questions/42833535 I believe that tmux in iTerm mode doesn’t support custom bindings (or even the default prefix commands, oddly enough) – fanaugen Sep 11 '17 at 09:03

3 Answers3

5

Someone reported a similar bug at iTerm2 Tmux Integration Default Keybindings not working in 2015. The response from the developer George Nachman suggests that keybindings are not supported:

One of the main goals of the tmux integration is that you use iTerm2's keystrokes, not tmux's. If there's a specific workflow that you can't accomplish natively, let me know--there is a lot of power in the ability to remap keys in iTerm2.

Ben Creasy
  • 3,825
  • 4
  • 40
  • 50
3

As of this change in iTerm2, you can now set a Leader key / prefix in the iTerm2 config which will forward to tmux. You still can't bring up the tmux command prompt, but you can create new windows, panes, etc, and my custom keybinds appear to be in working order.

You can configure the shortcut in Prefs > Keys > Key Bindings > Leader... Once you define a leader, the tmux key combos will become available. I recommend cmd-B as the leader for muscle memory and because cmd-B isn't otherwise in use.

This is what it should look like, note my prefix is the ` key but you should set this to whatever your tmux prefix binding is. the keys tab, under the key bindings menu, leader button

As of this writing the feature is only in the nightly build of iTerm2, so you'll be running alpha code, but assuming nothing goes wrong it should be included in the next stable release (or 3.5beta6).

HeroCC
  • 988
  • 15
  • 33
0

edit: Ben's answer that this is unsupported is correct. My advice does not apply to "integrated mode".

Make sure you don't have conflicting key mappings in iTerm, that your option key is set to Meta, and that you've tmux source ~/.tmux.conf after your changes (the config is only loaded by the server, so you have to restart all sessions or re-source). Also, if you're using Karabiner or another hotkey remapper, it could be interfering in some way.

You're starting with a rather extensive config - I'd start with a one line config for testing purposes.

micimize
  • 904
  • 9
  • 16
  • Were you able to actually get it working? Based on this https://gitlab.com/gnachman/iterm2/issues/3997 it appears that tmux keybindings are not supported. – Ben Creasy Nov 08 '17 at 03:19
  • @BenCreasy No - In retrospect, I misread the question, because I don't use integrated mode – micimize Nov 10 '17 at 21:56