Best key bindings for tmux

TMUX key bindings provide a powerful and efficient way to navigate and manipulate the terminal multiplexer. With customizable key combinations, users can streamline their workflow, saving valuable time and effort. 

TMUX is a terminal multiplexer, which is a command-line tool that allows you to divide a single terminal window into multiple panes, each containing its own command line interface. It provides a convenient way to work with multiple terminal sessions within a single window, making it easier to multitask and manage your workflow.

With TMUX, you can create, switch between, and detach terminal sessions, enabling you to keep processes running in the background even when you're not actively connected to a terminal. It's particularly useful for working on remote servers or managing long-running processes that need to continue running even after you disconnect from the terminal.

TMUX key bindings

These are its main features:

Multiple Panes: TMUX allows you to split your terminal window into multiple panes, each displaying a different command line interface. You can arrange the panes vertically or horizontally, resize them, and switch between them effortlessly.

Session Management: TMUX lets you create multiple sessions, each with its own set of panes. You can name and manage sessions, detach from them, and reattach to them later. This feature is especially useful for working on different projects or tasks simultaneously.

Window Management: Within each session, TMUX supports multiple windows, which are like tabs in a web browser. You can create, close, and switch between windows, each containing its own set of panes. This helps you organize your work and switch between different tasks quickly.

Detaching and Attaching: TMUX allows you to detach from a session without terminating the running processes within it. This means you can disconnect from a remote server or close your terminal window and later reattach to the session to resume your work right where you left off.

Customization: TMUX is highly customizable. You can configure key bindings, colors, status bars, and various other aspects to suit your preferences. It also supports scripting and automation, allowing you to create custom workflows and automate repetitive tasks.

With such level of configurability, you can tune almost anything to set it up as you prefer. As I work both in Linux and Windows environments I like to have key bindings in tmux that resembles the ones of Windows Terminal. That way I can switch between them without too much effort.

This is the list of key bindings for TMUX that I use. You can set them up just by copying them into your .tmux.conf file:

# Use Ctrl+Space as Prefix
unbind C-b
bind C-Space send-prefix
set -g prefix C-Space

# Notification
setw -g monitor-activity on

# Automatically set window titles
set-option -g set-titles on

# Ensure window index numbers get reordered on delete.
set-option -g renumber-windows on

# Set xterm-keys for vim
set-window-option -g xterm-keys on

# Set escape time for vim to zero
set -sg escape-time 0

# Create window
bind -n M-t new-window -c "#{pane_current_path}"

# Switch window
bind -n M-PageUp previous-window
bind -n M-PageDown next-window

# Split window
bind -n M-- split-window -v -c "#{pane_current_path}"
bind -n M-+ split-window -h -c "#{pane_current_path}"

# Switch pane
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

# Resize pane
bind -n M-C-Right resize-pane -R
bind -n M-C-Left resize-pane -L
bind -n M-C-Up resize-pane -U
bind -n M-C-Down resize-pane -D

# Copy mode to scroll up and down
setw -g mode-keys vi

# Show uptime
set -g status-right-length 100
set -g status-right '#(uptime)'

# Increase the scroll history in the buffer
set -g history-limit 50000

#### COLOUR (Solarized 256)

# default statusbar colors
set-option -g status-style fg=colour136,bg=colour235 #yellow and base02

# default window title colors
set-window-option -g window-status-style fg=colour244,bg=default #base0 and default

# active window title colors
set-window-option -g window-status-current-style fg=colour166,bg=default #orange and default

# set inactive/active window styles
set-window-option -g window-style fg=colour247,bg=colour236
set-window-option -g window-active-style fg=colour250,bg=black

# set the pane border colors
set -g pane-border-style fg=colour235,bg=colour238
set -g pane-active-border-style fg=colour166,bg=colour236

# message text
set-option -g message-style fg=colour166,bg=colour235 #orange and base02

# pane number display
set-option -g display-panes-active-colour colour33 #blue
set-option -g display-panes-colour colour166 #orange

# clock
set-window-option -g clock-mode-colour colour64 #green

# bell
set-window-option -g window-status-bell-style fg=colour235,bg=colour160 #base02, red

Popular posts from this blog

How to setup NeoVim configuration file

WebAssembly (Wasm): Fixing the Flaws of Applets

How to query Outlook from PowerShell