Tmux - Revelation

NexxsysNexxsys
2 min read

I was always partial to terminator as a terminal emulator, but there are times where it felt less productive and feature lacking. It was time to learn tmux, and tmux + terminator was a win for me!

Here is my setup (config file) for tmux

#set prefix
#set -g prefix C-a
#bind C-a send-prefix
#unbind C-b

#set -g history-limit 100000
#set -g allow-rename off

#bind-key j command-prompt -p "Join pan from:" "join-pane -s :'%%'"
#bind-key s command-prompt -p "Send pane to:" "join-pane -t :'%%'"

#set-window-option -g mode-keys vi

#run-shell /opt/tmux-logging/logging.tmux

# Improve colors

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

# Set scrollback buffer to 10000

set -g history-limit 10000

# Customize the status line

set -g status-fg  green
set -g status-bg  black

# remap prefix from 'C-b' to 'C-a'

unbind 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 %

# switch panes using Alt-arrow without prefix

# Doesn't appear to work

#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 (clickable windows, panes, resizable panes)

set -g mouse on

# don't rename windows automatically

# set-option -g allow-rename off

# Start windows and panes at 1, not 0

set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set-option -g renumber-windows on

setw -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection     # Begin selection in copy mode.
bind-key -T copy-mode-vi 'C-v' send -X rectangle-toggle  # Begin selection in copy mode.
bind-key -T copy-mode-vi 'y' send -X copy-selection      # Yank selection in copy mode.
#unbind-key -T copy-mode-vi v
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i"

# List of plugins

set -g @catppuccin_flavour 'mocha'

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'

# set -g @plugin 'christoomey/vim-tmux-navigator'

set -g @plugin 'dreamsofcode-io/catppuccin-tmux'

# set -g @plugin 'tmux-plugins/tmux-yank'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)

run '~/.tmux/plugins/tpm/tpm'

# References

# <https://hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/>

# <https://github.com/tmux/tmux/wiki/Getting-Started>

# <https://www.redhat.com/en/blog/introduction-tmux-linux>

# Tmux config git repository: <https://github.com/dreamsofcode-io/tmux>

# Tmux: <https://github.com/tmux/tmux>

# TPM: <https://github.com/tmux-plugins/tpm>

First - execute this from your home folder:

git clone <https://github.com/tmux-plugins/tpm> ~/.tmux/plugins/tpm

Second - copy the content above into your own ~/.tmux.conf file

Third - To initialise, be sure you have entered into tmux (tmux enter at the command prompt) then hit CTRL + B then SHIFT + I to load.

Now your controls will be CTRL + A and so on.

0
Subscribe to my newsletter

Read articles from Nexxsys directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Nexxsys
Nexxsys