wez-tmux

September 28, 2025 Β· View on GitHub

Port tmux key bindings to WezTerm, bringing familiar tmux navigation patterns to modern terminal emulator.

Note: This plugin ports tmux key bindings only, not the complete workflow or session management system.

πŸ—ΊοΈ Concept Mapping: tmux ↔ WezTerm

tmux ConceptWezTerm EquivalentDescription
SessionWorkspaceIsolated environments for different projects/contexts
WindowTabMultiple terminal views within a session/workspace
PanePaneSplit views within a window/tab
Prefix keyLeader keyModifier key that activates tmux-style commands (default: Ctrl+b)
Copy modeCopy modeText selection and navigation mode with enhanced capabilities

✨ Features

  • Familiar Key Bindings: All major tmux key combinations supported
  • Basic Navigation: tmux-style pane splitting, navigation, and resizing
  • Copy Mode: Enhanced text selection with tmux navigation patterns
  • Customizable: Easy configuration and leader key customization
  • Native Integration: Leverages WezTerm's native capabilities

πŸš€ Installation

# Clone into your WezTerm plugins directory
git clone https://github.com/sei40kr/wez-tmux.git "${XDG_CONFIG_HOME:-$HOME/.config}/wezterm/plugins/wez-tmux"

Method 2: Manual Installation

  1. Download or clone this repository
  2. Place the plugin directory in your WezTerm plugins path:
    # Typically:
    cp -r wez-tmux/plugin ~/.config/wezterm/plugins/wez-tmux/
    

βš™οΈ Configuration

Add to your wezterm.lua configuration file:

local wezterm = require("wezterm")

-- Initialize config with wezterm.config_builder() for forward compatibility
local config = wezterm.config_builder()

-- Configure your leader key (recommended to avoid conflicts)
config.leader = { key = "a", mods = "CTRL" }  -- Use Ctrl+a instead of default Ctrl+b

-- Apply wez-tmux plugin with optional configuration
require("plugins.wez-tmux.plugin").apply_to_config(config, {
    -- Optional: Customize tab index base (0-based or 1-based)
    -- tab_and_split_indices_are_zero_based = true
})

return config

⌨️ Comprehensive Key Bindings Reference

Leader Key Basics

Key CombinationDescription
leader + leaderSend the leader key itself
leader + [Enter copy mode for text selection

Workspace Management (tmux Sessions)

Key CombinationDescription
leader + $Rename current workspace
leader + sInteractive workspace switcher
leader + (Switch to previous workspace
leader + )Switch to next workspace

Tab Operations (tmux Windows)

Key CombinationDescription
leader + cCreate new tab in current domain
leader + &Close current tab (with confirmation)
leader + pSwitch to previous tab
leader + nSwitch to next tab
leader + lSwitch to last active tab
leader + 1-9Switch to specific tab by index

Pane Management

Splitting & Navigation

Key CombinationDescription
leader + %Split pane horizontally
leader + "Split pane vertically
leader + {Rotate panes counter-clockwise
leader + }Rotate panes clockwise
leader + arrowNavigate to pane in direction
leader + qInteractive pane selector

Resizing & Operations

Key CombinationDescription
leader + zZoom/unzoom current pane
leader + !Move pane to new tab
leader + ctrl + arrowResize pane in direction (5 cells)
leader + xClose current pane (with confirmation)

Copy Mode (Advanced Text Selection)

Key CombinationDescription
h/j/k/lBasic directional movement
w/b/eWord-based navigation
0Beginning of line
$End of line content
^Start of line content
gTop of scrollback
GBottom of scrollback
H/M/LViewport positioning

Scrolling & Paging

Key CombinationDescription
ctrl + bPage up
ctrl + fPage down
ctrl + uScroll up half page
ctrl + dScroll down half page

Search & Selection

Key CombinationDescription
/Search forward
?Search backward
nNext search result
NPrevious search result
vCell selection mode
shift + vLine selection mode
ctrl + vBlock selection mode
yCopy selection and exit
EscapeClear selection or exit

πŸ› οΈ Advanced Configuration

Custom Leader Key

-- Use Ctrl+Space as leader (recommended for minimal conflicts)
config.leader = { key = "Space", mods = "CTRL" }

-- Or use a letter key with modifier
config.leader = { key = "a", mods = "CTRL" }      -- Ctrl+a
config.leader = { key = "Space", mods = "ALT" }   -- Alt+Space

Zero-based vs One-based Indexing

require("wez-tmux.plugin").apply_to_config(config, {
    -- Use 0-based indexing for tabs (leader+0 for first tab)
    tab_and_split_indices_are_zero_based = true,

    -- Or keep 1-based indexing (default, leader+1 for first tab)
    tab_and_split_indices_are_zero_based = false,
})

πŸ”§ Troubleshooting

Common Issues

Copy Mode Ctrl+b Conflict

Problem: Ctrl+b doesn't work in copy mode for page up

Solution: Use a different leader key than Ctrl+b:

config.leader = { key = "a", mods = "CTRL" }  -- Use Ctrl+a instead

Key Binding Conflicts

Problem: Custom key bindings not working

Solution: Load wez-tmux after your custom bindings, or use wezterm.GLOBAL for advanced customization

Plugin Not Found

Problem: require("plugins.wez-tmux.plugin") fails

Solution: Ensure the plugin directory is in your WezTerm plugins path:

-- Add this if plugin isn't found automatically
package.path = package.path .. ";" .. wezterm.config_dir .. "/plugins/wez-tmux/?.lua"