diff --git a/tmux.conf b/tmux.conf index 45093c6..f30b5ba 100644 --- a/tmux.conf +++ b/tmux.conf @@ -1,7 +1,68 @@ -# Enable mouse scrolling in copy mode +# Enable mouse mode set-window-option -g mouse on +# Vi keys in copy mode +set-window-option -g mode-keys vi + # Switch prefix from C-b to C-t unbind C-b -set -g prefix C-t -bind C-t send-prefix +set -g prefix C-s +bind -r C-s send-prefix + +# Sourcing config +bind r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded" + + +# useful bind-key options +# -n works without prefix +# -r repeats without prefix + +# Pane navigation commands +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +## Resizing panes +# Fine adjustment (1 or 2 cursor cells per bump) +bind -n S-Left resize-pane -L 2 +bind -n S-Right resize-pane -R 2 +bind -n S-Down resize-pane -D 1 +bind -n S-Up resize-pane -U 1 + +# Coarse adjustment (5 or 10 cursor cells per bump) +bind -n C-Left resize-pane -L 10 +bind -n C-Right resize-pane -R 10 +bind -n C-Down resize-pane -D 5 +bind -n C-Up resize-pane -U 5 + +# Splitting panes +bind - split-window -v -c '#{pane_current_path}' +bind \\ split-window -h -c '#{pane_current_path}' + +# New window at current path +bind c new-window -c '#{pane_current_path}' + +# Status bar themeing +set-option -g status-bg '#666666' +set-option -g status-fg '#aaaaaa' + +# Start window/pane indices at 1, and renumber as they are created/destroyed +set-option -g base-index 1 +set-window-option -g pane-base-index 1 +set -g renumber-windows on + +# Toggle mouse-mode +bind m set-window-option mouse + +# Window switching with my mouse +bind -n C-Pageup previous-window +bind -n C-Pagedown next-window + +# Copy/paste +bind C-c run "tmux show-buffer | xsel -i --clipboard" +bind C-v run "tmux set-buffer \"$(xsel --clipboard)\"; tmux paste-buffer" +bind -T copy-mode-vi y send -X copy-selection-and-cancel +bind -T copy-mode-vi v send -X begin-selection +bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel 'xsel -i -f' +bind -T root MouseDown2Pane run "tmux set-buffer \"$(xsel)\"; tmux paste-buffer"