Skip to content

Instantly share code, notes, and snippets.

@xirixiz
Last active December 15, 2021 15:25
Show Gist options
  • Save xirixiz/3d8057481737a414bbe80cb882ca6cb3 to your computer and use it in GitHub Desktop.
Save xirixiz/3d8057481737a414bbe80cb882ca6cb3 to your computer and use it in GitHub Desktop.
tmux.conf based on Byobu (keyboard shortcuts as well). tmux >2.9 required!
# Put in ~/.bashrc | then source ~/.bashrc
if [[ -z "${TMUX}" ]] && [[ "${UID}" != 0 ]]; then
tmux new-session -A -s 0
fi
# Put in ~/.tmux.conf
# change the prefix from 'C-b' to 'C-a'
# (remap capslock to CTRL for easy access)
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# start with window 1 (instead of 0)
set -g base-index 1
# start with pane 1
set -g pane-base-index 1
# set refresh interval for status bar
set -g status-interval 60
set-option -g status-interval 60
# split panes using | and -, make sure they open in the same path
bind = split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# disable automatic window renaming
set-window-option -g automatic-rename on
bind-key -n F2 new-window -c "#{pane_current_path}"
bind-key -n C-F2 split-window -h -c "#{pane_current_path}"
bind-key -n S-F2 split-window -v -c "#{pane_current_path}"
bind-key -n F3 previous-window
bind-key -n F4 next-window
bind-key -n S-Up select-pane -U
bind-key -n S-Down select-pane -D
bind-key -n S-Left select-pane -L
bind-key -n S-Right select-pane -R
bind-key -n M-S-Up resize-pane -U
bind-key -n M-S-Down resize-pane -D
bind-key -n M-S-Left resize-pane -L
bind-key -n M-S-Right resize-pane -R
# bind-key -n S-F8 next-layout
bind-key -n M-1 next-layout
bind-key -n M-2 select-layout even-horizontal
bind-key -n M-3 select-layout even-vertical
bind-key -n M-4 select-layout main-horizontal
bind-key -n M-5 select-layout main-vertical
bind-key -n M-6 select-layout tiled
bind-key -n C-F6 kill-pane
bind-key -n F7 copy-mode
bind-key -n S-F12 resize-pane -Z
bind-key -n F12 set-option -g mouse \; display-message 'Mouse mode #{?mouse,on,off}!'
bind-key -n S-F9 set-window-option synchronize-panes\; display-message "Synchronize-panes is now #{?pane_synchronized,on,off}"
unbind '"'
unbind %
# open new windows in the current path
bind c new-window -c "#{pane_current_path}"
# reload config file
bind r source-file ~/.tmux.conf \; display "Reloaded tmux.conf!"
unbind p
bind p previous-window
# shorten command delay
set -sg escape-time 1
# don't rename windows automatically
set -g allow-rename off
# re-number windows when closed one
set -g renumber-windows on
# increase scroll-back history
set -g history-limit 100000
# mouse control (clickable windows, panes, resizable panes)
set -g mouse off
# Toggle mouse mode
unbind a
bind a set-option -g mouse \; display-message 'Mouse mode #{?mouse,on,off}!'
# enable vi mode keys
set-window-option -g mode-keys vi
# set default terminal mode to 256 colors
set -g default-terminal "screen-256color"
# present a menu of URLs to open from the visible pane. sweet.
bind u capture-pane \;\
save-buffer /tmp/tmux-buffer \;\
split-window -l 10 "urlview /tmp/tmux-buffer"
######################
### DESIGN CHANGES ###
######################
# loud or quiet?
set -g visual-activity off
set -g visual-bell off
set -g visual-silence off
setw -g monitor-activity off
set -g bell-action none
# modes
setw -g clock-mode-colour colour15
setw -g mode-style 'fg=colour15 bg=colour236'
# panes
set -g pane-border-style 'fg=colour236 bg=colour0'
set -g pane-active-border-style 'fg=colour166 bg=colour166'
# statusbar
set -g status-position bottom
set -g status-justify left
set -g status-style 'fg=colour15 bg=colour236'
set -g status-left ''
set -g status-right '#[fg=colour15,bg=colour236] %A %d/%m/%Y %H:%M:%S'
# set -g status-right '|#[fg=colour15,bg=colour236] #(whoami)@#(hostname) | %d-%m-%Y | %H:%M:%S'
# set -g status-right '|#[fg=colour15,bg=colour236] %d/%m |#[fg=colour15,bg=colour236] %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20
setw -g window-status-current-style 'fg=colour236 bg=colour15'
#setw -g window-status-current-format ' #I #[fg=colour236]#W#[fg=colour15]#F '
setw -g window-status-current-format ' X#I '
setw -g window-status-style 'fg=colour15 bg=colour236'
#setw -g window-status-format ' #I #[fg=colour15]#W#[fg=colour236]#F '
setw -g window-status-format ' #I '
setw -g window-status-bell-style 'fg=colour15 bg=colour236'
# messages
set -g message-style 'fg=colour236 bg=colour15'
#tmux_colors.sh
#!/bin/bash
#for i in {0..255} ; do
# printf "\x1b[38;5;${i}mcolour${i}\n"
#done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment