# Use vim keybindings in copy mode setw -g mode-keys vi # Setup 'v' to begin selection as in Vim bind-key -t vi-copy v begin-selection bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" # Update default binding of `Enter` to also use copy-pipe unbind -t vi-copy Enter bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy" # Smart pane switching with awareness of vim splits is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"' bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" # Restore clear screen () bind C-l send-keys 'C-l' bind C-k send-keys 'C-k'