dotfiles/.tmux.conf

119 lines
3.7 KiB
Plaintext

#
# zeldon's tmux config
#
# Some tweaks to the status line
set -g status-right "%H:%M"
set -g window-status-current-style "underscore"
# Scroll History
set -g history-limit 50000
# show messages for 4 seconds instead
set -g display-time 4000
# If running inside tmux ($TMUX is set), then change the status line to red
%if #{TMUX}
set -g status-bg red
%endif
# Enable RGB colour if running in xterm(1)
set-option -sa terminal-overrides ",xterm*:Tc"
# Change the default $TERM to tmux-256color
set -g default-terminal "tmux-256color"
# No bells at all
set -g bell-action none
# Keep windows around after they exit
set -g remain-on-exit on
# Turn the mouse on, but without copy mode dragging
set -g mouse on
# Status bar
set-option -g status on
set-option -g status-interval 1
set-option -g status-justify centre
set-option -g status-keys vi
set-option -g status-position bottom
set-option -g status-style fg=colour136,bg=colour235
set-option -g status-left-length 35
set-option -g status-left-style default
set-option -g status-left "#[fg=green]#H #[fg=green,bright]#(uname -r)#[default]"
set-option -g status-right-length 140
set-option -g status-right-style default
set-option -g status-right "#[fg=green,bg=default,bright]#(tmux-mem-cpu-load -i 3 -a 0 -g 0) #[default]"
set-option -ag status-right "#[fg=red,dim,bg=default]#(uptime | cut -f 4-5 -d ' ' | cut -f 1 -d ',') "
set-option -ag status-right "#[fg=white,bg=default]%a %H:%M:%S #[fg=blue]%Y-%m-%d"
set-window-option -g window-status-style fg=colour244
set-window-option -g window-status-style bg=default
set-window-option -g window-status-current-style fg=colour166
set-window-option -g window-status-current-style bg=default
# Some extra key bindings to select higher numbered windows
bind F1 selectw -t:10
bind F2 selectw -t:11
bind F3 selectw -t:12
bind F4 selectw -t:13
bind F5 selectw -t:14
bind F6 selectw -t:15
bind F7 selectw -t:16
bind F8 selectw -t:17
bind F9 selectw -t:18
bind F10 selectw -t:19
bind F11 selectw -t:20
bind F12 selectw -t:21
# New panes in current path
bind c new-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind '"' split-window -v -c "#{pane_current_path}"
# A key to toggle between smallest and largest sizes if a window is visible in
# multiple places
bind F set -w window-size
# Keys to toggle monitoring activity in a window and the synchronize-panes option
bind m set monitor-activity
bind y set synchronize-panes\; display 'synchronize-panes #{?synchronize-panes,on,off}'
# Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access.
set -s escape-time 50
## Clipboard integration
# ctrl+c to send to clipboard
bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"
# ctrl+v to paste from clipboard
bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"
# Selection with mouse should copy to clipboard right away, in addition to the default action.
unbind -n -Tcopy-mode-vi MouseDragEnd1Pane
bind -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel\; run "tmux save-buffer - | xclip -i -sel clipboard > /dev/null"
# Middle click to paste from the clipboard
unbind-key MouseDown2Pane
bind-key -n MouseDown2Pane run " \
X=$(xclip -o -sel clipboard); \
tmux set-buffer \"$X\"; \
tmux paste-buffer -p; \
tmux display-message 'pasted!' \
"
# Drag to re-order windows
bind-key -n MouseDrag1Status swap-window -t=
# set first window to index 1 (not 0) to map more to the keyboard layout
set-option -g renumber-windows on
set -g base-index 1
setw -g pane-base-index 1
# Create a single default session - because a session is created here, tmux
# should be started with "tmux attach" rather than "tmux new"
new -d -s1 -nfish 'fish'
set -t1:1 monitor-activity on
set -t1:1 aggressive-resize on
neww -d
neww -d