How to remap tmux split pane keys

command lineitermterminaltmux

On my linux machines, for my terminal shell I have tmux keys mapped to allow me to split windows and then switch between new panes.

With or without these mappings I can't figure out how to remap the key combo's on my mac that let me divide the terminal window and stay in whatever directory I'm currently in, for the new window. This is really handy for all my terminal work.

I can use the Iterm menu itself and/or the shortcut key combos it shows but these all seem to be are Iterm split windows not tmux and the one thing they don't do is set the same directory, they go to the my home directory (~).

Note this is not about switching tmux panes, that works, and it's not about switching Iterm panes as in iterm – what's the key-combo to switch panes? and the advanced configuration didn't seem to take effect either: enter image description here

Does anyone know the key combo or mapping I can use/make to get the 'tmux split and stay in directory' functionality on my mac. Model is about 2 years old.

I thought I had found it for the native window pane splitting within iterm splitting with the settings below, changing Working Directory from Home directory to Reuse previous session's directory:

enter image description here

but it didn't work, I'm still getting my home directory in new panes for Iterm window panes.

[Update – I've found that the original tmux key combo's for this – actionKey + " and actionKey plus % (no wonder I've remapped them!) do actually work on my mac, i.e.

enter image description here

So it seems that my remapping of them in .tmux.conf with

set -g prefix C-a # this just changes my prefix from ctrl-b to ctrl-a
bind \ split-window -h # Split panes horizontal
bind - split-window -v # Split panes vertically

isn't working (the remap of ctrl-a works but the binding of the other two keys for split panes doesn't), why might that be?

My entire .tmux.conf file is:

$ cat .tmux.conf
bind r source-file ~/.tmux.conf \; display "Reloaded!" # Reload with ctrl-r
set -g prefix C-a # prefix from ctrl-b to ctrl-a
unbind C-b # allow ctrl-b for other things
set -sg escape-time 1 # quicker responses
bind C-a send-prefix # Pass on ctrl-a for other apps
set -g base-index 1 # Numbering of windows
setw -g pane-base-index 1 # Numbering of Panes
bind \ split-window -h # Split panes horizontal
bind - split-window -v # Split panes vertically

I've also tried removing my .vimrc file though it shouldn't have been relevant to the terminal shell issue but I did it anyway and it didn't helped.

Info Update:

$ tmux -V
tmux 1.8
[mdurrant@Macintosh ~]
$ tmux list-keys | grep split
bind-key          " split-window
bind-key          % split-window -h

p.s. I've updated the title to reflect my updates.

Best Answer

I needed to reload (perhaps 'apply' is more appropriate) my configuration file.
I had restarted my mac and thought this would have done it but I still needed to do:

$ tmux source-file ~/.tmux.conf

Note: type this exactly as shown. source-file is literally what you type (or copy-paste) it is NOT something you replace with your own value).