<<

Tmux Setup

tmux 4 panes

How I use tmux

Tmux is a terminal multiplexer: it lets you open multiple panes, windows, and sessions seamlessly. I started using it for a neatly organized terminal setup and am perfecting its use while trying to solve CTF challenges. Being efficient in moving from one terminal window to the other is essential for ease of mind. Additionally, exploiting tmux splitting panes functions with pwntools script, I think, can give you a competitive edge when debugging exploits.

tmux prefix

# Set prefix to Ctrl
unbind C-b
set -g prefix C-a

The prefix is a combination of keys that initiate any tmux command. For this reason, it must be comfortable and easily reachable. When learning touch typing, that is, writing without looking at the keyboard, you first learn to keep your hand on the home row. In the qwerty layout, the home row starts with ‘a’ and ends with ‘l.’ In fact, from this position, specifically with your index fingers on ‘f’ and ‘j,’ you have the best access to every other key. All this introduction justifies why I always swap the Ctrl and the Caps Lock key on all my setups. Hopefully, this clarifies why Ctrl-a is an excellent choice for a tmux prefix.

Panes navigation and window-splitting

# Vim-like key bindings for pane navigation (default uses cursor keys).
unbind h
bind h select-pane -L
unbind j
bind j select-pane -D
unbind k
bind k select-pane -U
unbind l # normally used for last-window
bind l select-pane -R

# Intuitive window-splitting keys.
bind ] split-window -h -c '#{pane_current_path}' # normally prefix-%
bind - split-window -v -c '#{pane_current_path}' # normally prefix-"

Once you learn Vim’s core motions, nothing else makes sense.

# Escape time for NeoVim
set-option -sg escape-time 10

NeoVim and tmux shortcuts may go in contrast; these settings make them work smoothly.

Minimal status bar

# Plugins
set -g @plugin 'niksingh710/minimal-tmux-status'

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

I only have one plugin to have minimal the status bar.

Daily set up

My standard setup is:

  • 1st window : neovim + zsh
  • 2nd window : zsh + gdb

tmux set up 1

tmux set up 1

I easily manage windows with:

<Prefix> + n (next)
<Prefix> + c (create)
<Prefix> + x (kill)
<Prefix> + , (rename)