# ============================================= # # Start with defaults from the Sensible plugin # # --------------------------------------------- # run-shell /nix/store/bdcb2dpg53ydd4yb6hk5ar7qxxlzhdrq-tmuxplugin-sensible-unstable-2017-09-05/share/tmux-plugins/sensible/sensible.tmux # ============================================= # set -g default-terminal "screen-256color" set -g base-index 0 setw -g pane-base-index 0 set -g status-keys vi set -g mode-keys vi # rebind main key: C-a unbind C-b set -g prefix C-a bind a send-prefix bind C-a last-window setw -g aggressive-resize off setw -g clock-mode-style 12 set -s escape-time 500 set -g history-limit 2000 # Set repeat time to less so I can cycle through history more easily set-option -g repeat-time 50 # Enable mouse control (clickable windows, panes, resizable panes) set -g mouse on # reload config file (change file location to your the tmux.conf you want to use) bind r source-file ~/.tmux.conf bind '-' split-window -c "#{pane_current_path}" bind '|' split-window -h -c "#{pane_current_path}" bind c new-window -c "#{pane_current_path}" bind-key -T copy-mode-vi 'v' send -X begin-selection # bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel # For binding 'y' to copy and exiting selection mode bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -sel clip -i' # Smart pane switching with awareness of Vim splits. # See: https://github.com/christoomey/vim-tmux-navigator is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|\.?n?vim?x?(-wrapped)?)(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' tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ "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