post image February 8, 2022 | 3 min Read

My tmux conf

# ----
# Our .tmux.conf file
# Setting the prefix from C-b to C-a
# set -g default-terminal "xterm-256color"

set -g default-terminal "screen-256color"

set -g default-command /bin/zsh
set -g prefix C-a
set -g history-limit 50000

# Free the original Ctrl-b prefix keybinding
unbind C-b
#setting the delay between prefix and command
set -sg escape-time 1
# Ensure that we can send Ctrl-A to other apps
bind C-a send-prefix
# Set the base index for windows to 1 instead of 0
set -g base-index 1
# Set the base index for panes to 1 instead of 0
setw -g pane-base-index 1
# Reload the file with Prefix r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# splitting panes
bind | split-window -h
bind - split-window -v
# moving between panes
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Quick pane selection
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# Pane resizing
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5

bind Left select-pane -L
bind Down select-pane -D
bind Up select-pane -U
bind Right select-pane -R

# mouse support - set to on if you want to use the mouse
set -g mouse on

# To copy, left click and drag to highlight text in yellow, 
# once you release left click yellow text will disappear and will automatically be available in clibboard
# # Use vim keybindings in copy mode

# Set the default terminal mode to 256color mode
# set -g default-terminal "screen-256color"
# enable activity alerts
setw -g monitor-activity on
set -g visual-activity on

# Log output to a text file on demand
bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"

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 20
set-option -g status-left-style default
#set-option -g status-left "#[fg=green]#H #[fg=black]• #[fg=green,bright]#(uname -r)#[default]"
set-option -g status-left "#[fg=green]#H #[fg=black]• #[fg=green,bright] #[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) "
set-option -g status-right "#[fg=green,bg=default,bright] "
# 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%l:%M:%S %p#[default] #[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
set-window-option -g window-status-current-style fg=white
set-window-option -g window-status-current-style bg=red



setw -g window-status-style fg=yellow,none
setw -g window-status-activity-style fg=green,bg=black,none
# setw -g window-status-style


setw -g mode-keys vi
unbind p
bind-key p paste-buffer
bind-key -T copy-mode-vi 'v' send -X begin-selection
# This works well
# bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
# bind-key -T copy-mode-vi 'y' send -X  copy-pipe "xclip -selection clipboard -i"
# ---> Testing .... < ---
# bind-key -T copy-mode-vi y send -X copy-selection-and-cancel\; run "tmux save -|xclip -sel clip >/dev/null 2>&1"
bind-key -T copy-mode-vi y send -X copy-selection-and-cancel\; run "tmux save -|pbcopy >/dev/null 2>&1"
# bind-key -t vi-copy 'v' begin-selection
# bind-key -t vi-copy 'y' copy-selection

author image

Jan Toth

I have been in DevOps related jobs for past 6 years dealing mainly with Kubernetes in AWS and on-premise as well. I spent quite a lot …

comments powered by Disqus