OpenBSD 6.5 tmux updates

· 4min · Dan F.

As you may know, OpenBSD recently released version 6.5. With this new release, came a updated version of tmux, which has implemented a number of configuration changes that may require an updated tmux.conf. While -current has had these updates for awhile, I had simply ignore tmux's warnings. However, since updating my systems to 6.5, I was finally complied and updated my conf.

There was only one area that was updated for tmux in 6.5, which was noted in the release notes for this release.

According to the release notes, a syntax change introduced a new "style". An old configuration would look like this:

set-window-option -g window-status-fg colour244
set-window-option -g window-status-bg colour222
set-window-option -g window-status-attr bold

The new standard takes in this case "window-status" and appends a -style. Take note that I am using colour, not color. This will take a list of attributes and values, shown below:

set-window-option -g window-status-style "fg=colour244 bg=colour222 bold"

My config has since been updated to the following config, and can be found published here:

###################
### Unbind keys ###
###################

unbind A
unbind Up
unbind Down
unbind Left
unbind Right
unbind C-Up
unbind C-Down
unbind C-Left
unbind C-Right
unbind M-Up
unbind M-Down
unbind M-Left
unbind M-Right
unbind C-z

######################
### Global options ###
######################

# Set escape keys to screen's default
set -g prefix C-a

# Setup tmux paste
bind p paste-buffer

# Set scrollback history to 10K lines
set -g history-limit 10000

# Shorten command delay
set -sg escape-time 1

# Fix ctrl and shift with arrow keys in putty
set-option -g default-terminal "screen-256color"
setw -g xterm-keys on

# Old setting used for putty
#set -g terminal-overrides "xterm*:kLFT5=\eOD:kRIT5=\eOC:kUP5=\eOA:kDN5=\eOB:smkx@:rmkx@"

# Make mouse useful in copy mode
set -g mouse on

# Allow mouse dragging to resize panes. Disabled, as this was seen to cause instability
#set -g mouse-resize-pane on

# Fix ctrl-left/right key work
set-window-option -g xterm-keys on

# Start window indexing at 1 and not 0
set -g base-index 1

#################
### BIND KEYS ###
#################

# Reload config with ctrl+a r
bind r source-file ~/.tmux.conf \; display "Reloaded!"

# Configure Ctrl+Arrow keys to create and navigate through windows
bind -n C-Left previous-window
bind -n C-Right next-window
bind -n C-Up new-window
bind -n C-Down confirm-before -p "kill-window #P? (y/n)" kill-window

# Configure Alt+Arrow keys to create and navigate through panes
bind-key -n M-Left select-pane -t :.-
bind-key -n M-Down confirm-before -p "kill-pane #P? (y/n)" kill-pane
bind-key -n M-Right select-pane -t :.+
bind-key -n M-UP split-window -h
bind-key -n C-_ split-window -v

# Configure Ctrl+Space to resize pane
bind Down resize-pane -D 20                  # (Resizes the current pane down by 10 cells)
bind Up resize-pane -U 20                    # (Resizes the current pane upward by 10 cells)
bind Left resize-pane -L 20                  # (Resizes the current pane left by 10 cells)
bind Right resize-pane -R 20                 # (Resizes the current pane right by 10 cells)

#####################
### Function Keys ###
#####################

# Sync panes within window
bind-key -n C-s setw synchronize-panes

# Zoom into pane
bind-key -n C-z resize-pane -Z  

# disable tmux native clipboard
set -sg set-clipboard off

#######################
### Custom Menu Bar ###
######################

# Turn the status bar on
set-option -g status on

# Set update freq to 5 seconds, from default of 15
set -g status-interval 5

# Center the window list
set -g status-justify centre

# Set visual notifications
setw -g monitor-activity on
set -g visual-activity on

# Set color for status bar
set-option -g status-bg colour236
set-option -g status-fg colour202

# Set window list colors; red for active, white for inactive
set-window-option -g window-status-style "dim"

# Set current window style
set-window-option -g window-status-current-style "bright"

# Set window title
setw -g automatic-rename on
set-option -g set-titles on
set-option -g set-titles-string 'tmux:#I #W'

# Don't erase terminal contents on editor exit
set-window-option -g alternate-screen on

# Show hostname and IP address on the left side of status bar
set-option -g status-left-length 100
set -g status-left ' #( sysctl -n vm.loadavg ) '

# Show session name, window, pane number, date and time on right side
set -g status-right-length 100

# Setup right startup to show the time and date
set-option -g status-right "%H:%M %Y-%m-%d"         # My original

Has been tested on OpenBSD 6.5