# --------# # General # # --------# # Default shell set -g default-shell $SHELL # Mouse # enable mouse control by default - change 'off' to 'on' to enable by default. set-option -g mouse on # toggle mouse mode to allow mouse copy/paste # set mouse on with prefix m bind m \ set-option -g mouse on \;\ display 'Mouse: ON' # set mouse off with prefix M bind M \ set-option -g mouse off \;\ display 'Mouse: OFF' # History set -g history-limit 1024000 # Set windows and page index to base 1 set -g base-index 1 setw -g pane-base-index 2 # Re-number windows when creating/closing new windows set -g renumber-windows on # Use emacs key bindings in status line set-option -g status-keys emacs # Use vim key bindings in copy mode setw -g mode-keys vi # Fix ESC delay in vim set -g escape-time 10 # ------------# # Keybindings # # ------------# # Set prefix to C-a unbind C-b set -g prefix C-a # Copy-mode unbind-key -T copy-mode-vi v bind-key -T copy-mode-vi v send-keys -X begin-selection bind-key -T copy-mode-vi 'C-v' send-keys -X rectangle-toggle bind-key -T copy-mode-vi y send-keys -X copy-pipe "pbcopy" bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-selection-no-clear "pbcopy" bind-key -T copy-mode-vi Escape send-keys -X cancel # Send command on double press bind C-a send-prefix # Use prefix C-l to clear the visible scrollback lines bind C-l send-keys 'C-l' # Use prefix C-k to clear the scrolled off (hidden) buffer lines bind C-k clear-history # Reload tmux.conf on prefix r bind r source-file ~/.tmux.conf \; display "Config reloaded!" # Split panes and remember current path bind '\' split-window -h -c '#{pane_current_path}' bind - split-window -v -c '#{pane_current_path}' # Remember current path when creating new windows bind c new-window -c '#{pane_current_path}' # Break pane into new window and keep focus on the current window bind b break-pane -d # Smart pane switching with awareness of Vim splits. is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" bind-key -n 'C-\' if-shell "$is_vim" "send-keys 'C-\'" "select-pane -l" bind-key -T copy-mode-vi C-h select-pane -L bind-key -T copy-mode-vi C-j select-pane -D bind-key -T copy-mode-vi C-k select-pane -U bind-key -T copy-mode-vi C-l select-pane -R bind-key -T copy-mode-vi 'C-\' select-pane -l bind-key -T prefix h select-pane -L bind-key -T prefix j select-pane -D bind-key -T prefix k select-pane -U bind-key -T prefix l select-pane -R #bind-key -T prefix 'C-\' select-pane -l # -----------# # Status bar # # -----------# set-option -g status-justify left set-option -g status-left '#[bg=colour72] #[bg=colour237] #[bg=colour236] #[bg=colour235]#[fg=colour185] #S #[bg=colour236] ' set-option -g status-left-length 16 set-option -g status-bg colour237 set-option -g status-right '#[bg=colour236] #[bg=colour235]#[fg=colour185] %a %R #[bg=colour236]#[fg=colour3] #[bg=colour237] #[bg=colour72] #[]' set-option -g status-interval 60 set-option -g pane-active-border-style fg=colour246 set-option -g pane-border-style fg=colour238 set-window-option -g window-status-format '#[bg=colour238]#[fg=colour107] #I #[bg=colour239]#[fg=colour110] #[bg=colour240]#W#[bg=colour239]#[fg=colour195]#F#[bg=colour238] ' set-window-option -g window-status-current-format '#[bg=colour236]#[fg=colour215] #I #[bg=colour235]#[fg=colour167] #[bg=colour234]#W#[bg=colour235]#[fg=colour195]#F#[bg=colour236] ' # ----------- # # Resize Pane # # ----------- # bind-key -r -T prefix C-k resize-pane -U bind-key -r -T prefix C-j resize-pane -D bind-key -r -T prefix C-h resize-pane -L bind-key -r -T prefix C-l resize-pane -R set -ga terminal-overrides ",*-256color:Tc" bind-key -T prefix C-y run-shell -b "tmux save-buffer - | xclip -i -sel clipboard" # Set new panes to open in current directory bind c new-window -c "#{pane_current_path}" bind '"' split-window -c "#{pane_current_path}" bind % split-window -h -c "#{pane_current_path}"