Skip to content

Instantly share code, notes, and snippets.

@secure-77
Last active January 31, 2021 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save secure-77/7979074659911e5a8f3a5d72479c12c6 to your computer and use it in GitHub Desktop.
Save secure-77/7979074659911e5a8f3a5d72479c12c6 to your computer and use it in GitHub Desktop.
tmux configuration
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g history-limit 10000
setw -g monitor-activity on
bind-key s split-window -h
bind-key v split-window -v
# Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# No delay for escape key press
set -sg escape-time 0
# Reload tmux config
bind r source-file ~/.tmux.conf
# THEME
set -g status-bg black
set -g status-fg white
set -g window-status-current-style 'bg=white fg=black'
set -g status-interval 60
set -g status-left-length 30
set -g status-left '#[fg=green](#S) #(whoami)'
set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M#[default]'
# Enable mouse & Copy/Paste - Requirements: xclip
#set -s set-clipboard on
set -g mouse on
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
bind -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
bind -T copy-mode-vi C-WheelUpPane send-keys -X halfpage-up
bind -T copy-mode-vi C-WheelDownPane send-keys -X halfpage-down
bind -T copy-mode-emacs C-WheelUpPane send-keys -X halfpage-up
bind -T copy-mode-emacs C-WheelDownPane send-keys -X halfpage-down
# # Use vim keybindings in copy mode
setw -g mode-keys vi
# Update default binding of `Enter` to also use copy-pipe
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -selection c"
# Mouse selection copy to xclip and to clipboard
unbind -n -T copy-mode-vi MouseDragEnd1Pane
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -in; xclip -out | xclip -in -selection clipboard"
# Middle click to paste from xclip
unbind-key MouseDown2Pane
bind-key -n MouseDown2Pane run "xclip -o -selection clipboard"
# Deactivate right mouse click
unbind-key MouseDown3Pane
bind-key -n MouseDown3Pane run ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment