Files
dotfiles/.tmux.conf
2024-04-05 10:13:15 +02:00

122 lines
3.5 KiB
Bash

# Make it use C-a, similar to screen..
#unbind C-b
#set -g prefix C-y
#set -g prefix C-a
set-option -g prefix C-y
unbind-key C-y
bind-key C-y send-prefix
# Make TMUX status-position display on top
set-option -g status-position top
set -g default-terminal "screen-256color"
set -g history-limit 50000
# Tmux mouse mode
set-option -g mouse on
## Enable mouse with 'm' and disable with 'M'
unbind m
bind m \
set -g mouse on \;\
display 'Mouse: ON'
unbind M
bind M \
set -g mouse off \;\
display 'Mouse: OFF'
# THEME
set -g status-bg colour235
set -g status-fg yellow
#set-option -g status-attr dim
#set-window-option -g window-status-current-fg brightred #orange
#set-window-option -g window-status-current-bg colour236
#set-window-option -g window-status-current-attr bright
set -g status-interval 60
#set -sg escape-time 1000
set-option -g base-index 1
setw -g aggressive-resize on
set -g status-justify centre
#set -g status-left '#[fg=green]#(whoami)@#H#[default]'
set -g status-left-length 70
set -g status-left "#[fg=yellow]#(ifconfig | grep 'inet ' | grep -v 127.0.0.1 | awk '{print \"Local \" $2}') #[fg=red]#(ifconfig tun0 | grep 'inet ' | awk '{print \"vpn \" $2}') #(ifconfig ppp0 | grep 'inet ' | awk '{print \"vpn \" $2}')"
# show session name, window & pane number, date and time on right side of status bar
set -g status-right-length 60
set -g status-right "#[fg=green]#S #I:#P #[fg=yellow]:: %d %b %Y #[fg=green]:: %H:%M %p :: #(date -u | awk '{print $4}')::"
# set pane colors - hilight the active pane
#set-option -g pane-border-fg colour235 #base02
#set-option -g pane-active-border-fg colour240 #base01
# use PREFIX | to split window horizontally and PREFIX - to split vertically
bind | split-window -h
bind - split-window -v
# Make the current window the first window
#bind T swap-window -t 1
# and use C-h and C-l to cycle thru panes
#bind -r C-h select-window -t :-
#bind -r C-l select-window -t :+
bind o copy-mode
bind p paste-buffer
# Resize window with alt arrow keys
#bind-key -n C-S-Up resize-pane -U 10
#bind-key -n C-S-Down resize-pane -D 10
#bind-key -n C-S-Left resize-pane -L 10
#bind-key -n C-S-Right resize-pane -R 10
# Use alt-arrow 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
# Rename window with ctrl a r
#bind-key -r r command-prompt 'rename-window %%'
# Reorder windows
#bind R \
# move-window -r\; \
# display-message "Windows reordered..."
## pane border and colors
#set-option -g pane-active-border-fg yellow
#set-option -g pane-border-fg white
# Snychronise panes
bind ^ setw synchronize-panes
#bind -n j send-prefix
# enable plugins to save sessions
# (Ctrl+A Ctrl+S to Save / Ctrl+A Ctrl+R to Resurrect)
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# automatically restore session
set -g @continuum-restore 'on'
set -g @continuum-boot 'off'
# enable reload of config
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
# pass SSH_AUTH_SOCKET
#set-environment -g 'SSH_AUTH_SOCK' ~/.ssh/ssh_auth_sock
# enable copy-paste
bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"
#bind C-v run "tmux set-buffer "$(xclip -o -sel clipboard)"; tmux paste-buffer"
# Initialize tmux plugin manager
run '~/.tmux/plugins/tpm/tpm'