Tmux Configuration

Mar 5, 2020 20:33 · 467 words · 3 minute read

#####################################
# Bindings
#####################################


# Splits always start in the current pane's working directory
unbind '"'
unbind %
bind '"' split-window -v -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
# Vim movements
bind C-h select-pane -L
bind C-j select-pane -D
bind C-k select-pane -U
bind C-l select-pane -R
# Easy resizing of the pane
bind H resize-pane -L 3
bind J resize-pane -D 3
bind K resize-pane -U 3
bind L resize-pane -R 3
# Rollodex commands
bind n run-shell "rolodex next"
bind p run-shell "rolodex prev"
bind C-m run-shell "rolodex toggle"
bind C-e run-shell "rolodex new"
# Bind the last window/pane command
bind C-b last-pane
# Faster window switching
bind C-n next-window
bind C-p previous-window
bind S switch-client -l
# Synchronize mode
bind a set-window-option synchronize-panes
# Remap zoom, sleeping tmux way too much
bind C-v resize-pane -Z
# I constantly mix up copy/paste. Very annoying/dangerous if cliboard has commands in it
unbind [
bind C-g copy-mode
# Tmux copy commands
bind -Tcopy-mode-vi v send -X begin-selection
bind -Tcopy-mode-vi y send -X copy-pipe-and-cancel "tmux save-buffer - | xp"
# Hitting enter will copy text but not leave vi mode
unbind -T copy-mode-vi Enter
bind -Tcopy-mode-vi Enter send -X copy-pipe "tmux save-buffer - | xp"
# clock mode is over written by sessionist
bind C-t clock-mode

#####################################
# Settings
#####################################

# Help with the color problems
set -g default-terminal "screen-256color"
# Mouse Scrolling
set-option -g mouse on
# Use vim keybindings in copy mode and help menus
setw -g mode-keys vi
# Set the display panes timeout
set-option -g display-panes-time 4000
# Make the escape faster, faster command sequences
set -s escape-time 0
# Deal with screens having different sizes
set-window-option -g aggressive-resize
# Use base 1 numbering, 0 base is a big stretch
set -g base-index 1
setw -g pane-base-index 1
# Increase the history
set -g history-limit 50000

#####################################
# Colors
#####################################

set-option -g status-style "fg=colour255"
set-option -g pane-border-style "fg=colour236"
set-option -g pane-active-border-style "fg=colour239"
set-option -g message-style "fg=colour196"
set-option -g status on
set-option -g status-interval 2
set-option -g status-justify "centre"
set-option -g status-left-length 110
set-option -g status-left "#S [#H]"
set-option -g status-right "#{?window_bigger,[#{window_offset_x}#,#{window_offset_y}] ,}\"#{=21:pane_title}\" %H:%M %Y-%m-%d"

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'Thornycrackers-Forks/tmux-sessionist'
set -g @plugin 'Thornycrackers-Forks/tmux-open'
set -g @plugin 'Thornycrackers-Forks/tmux-fingers'
set -g @fingers-main-action 'tmux save-buffer - | xp'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

The only recommendations I can give when you are creating your own tmux config is that you should fork the plugins you wish to use and use them in your config so that you can pin your dependancies. Then if you want to get the latest version of the code you can just pull from upstream, having your code break unexpectedly is never fun.