Skip to content

Instantly share code, notes, and snippets.

@amirrajan
Created May 20, 2025 20:22
Show Gist options
  • Save amirrajan/878acac7cdfa717d3bb9579bbc673319 to your computer and use it in GitHub Desktop.
Save amirrajan/878acac7cdfa717d3bb9579bbc673319 to your computer and use it in GitHub Desktop.
tmux for windows (specifically clipboard)
# ~/.tmux.conf
# * brew install tmux reattach-to-user-namespace
# * C-e - Your leader <l> key.
# * <l>: - Type command not handled by shortcut keys. Eg: <l>: kill-pane ENT
# * <l>r - Reload this file/config.
# * <l>j - Select split using number jump list.
# * <l>{ - Swap splits left.
# * <l>} - Swap splits right.
# * <l>| - Create vertical split.
# * <l>- - Create orizontal split.
# * C-hjkl - Move around between splits.
# * C-HJKL - Resize splits.
# * <l>z - Toggle "fullscreen" for split.
# * <l>c - New frame.
# * <l>n - Cycle frame.
# * <l>SPC - Cycle layouts.
# * <l>a - Enter Copy Mode/Scrolling Mode.
# The following commands are only available in copy mode.
# ** y - Yank selection/exit copy mode.
# ** hjkl - Navigate/move cursor
# ** C-b - Page up.
# ** C-f - Page down.
# ** C-u - Half page up.
# ** v - Character copy mode.
# ** V - Line copy mode.
# ** C-v - Block copy mode.
# ** <l>= - View kill ring.
# ** ? - Search for text up.
# ** / - Search for text down.
# The following command are available after enter a search term.
# *** n - Next result.
# *** N - Previous result.
set -g pane-border-style fg=lightgray
set -g pane-active-border-style bg=default,fg=orange
set -g pane-border-status top
set -g pane-border-format "#{pane_title} [#{pane_index}] "
set -g mouse on
set -g prefix C-s
set -g display-time 4000
set -g display-panes-time 4000
bind s send-prefix
unbind C-e
unbind C-s
unbind C-m
unbind C-a
unbind C-j
unbind C-l
unbind C-h
bind j display-panes
bind m setw synchronize-panes
bind C-a last-window
set -s escape-time 1
set -g base-index 1
setw -g pane-base-index 1
bind r source-file ~/.tmux.conf \; display "Reloaded!"
bind C-s send-prefix
bind | split-window -h
bind - split-window -v
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep 'emacs') && (tmux send-keys C-h) || (tmux select-pane -L)"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep 'emacs') && (tmux send-keys C-j) || (tmux select-pane -D)"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep 'emacs') && (tmux send-keys C-k) || (tmux select-pane -U)"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep 'emacs') && (tmux send-keys C-l) || (tmux select-pane -R)"
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
set -g default-terminal "xterm-256color"
setw -g mode-keys vi
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind-key -T copy-mode Tab
unbind -T copy-mode-vi Space
unbind-key -T copy-mode-vi Enter
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "cat > ~/clipboard.txt && cat ~/clipboard.txt | clip"
bind-key -T copy-mode-vi v send-keys -X begin-selection
set -s -g escape-time 0
set -s -g status-interval 0
unbind-key -T copy-mode-vi C-v
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
set-option -g history-limit 50000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment