Configuring Vim and Tmux

My development environment has changed a lot of late. Where I previously used a macbook pro, I find myself using a Chromebook more these days.

While things like Crostini are great for local development, I find myself wanting an environment I can just jump into when I have a few minutes. I’m usually on the road, so I want to be able to kick off installs / downloads and have that work reliably without relying on my local connection.

My current set up of choice is a Chromebook + Raspberry Pi. The latter is a low power way for me to have an always on machine connected to my fibre connection at home. The former is a great as a travel machine. Generally lightweight, long battery life and a fairly decent SSH extension for connecting to the Pi.

Initially, I was SSHing directly into the Pi, but this meant that when I lost my connection, anything I was doing would stop.

Enter tmux.

Below is my configuration for tmux:

# set the tmux command prefix to ctrl+a. (Like screen)
bind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %

# reload config file
# e.g. ctrl+a then r
bind r source-file ~/.tmux.conf

#switch panes using alt-arrow without prefix
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

#enable mouse control
set -g mode-mouse on
set -g @scroll-speed-num-lines-per-scroll 0.1

#vim stuff
set -g status-keys vi
setw -g mode-keys vi
set -gw xterm-keys on
set -g default-terminal "xterm-256color"
set -g status-bg black
set -g status-fg white
set -g window-status-current-bg white
set -g window-status-current-fg black
set -g window-status-current-attr bold
set -g status-interval 60
set -g status-left-length 30
set -g status-left '#[fg=green](#S) #(whoami)'
set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M#[default]'