Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
122 lines (95 sloc) 3.33 KB
# Change Default Prefix Key
set -g prefix C-q
unbind C-b
# Delay after Pressing Prefix Key
set -sg escape-time 1
# Make ^a sendable to other programs
bind C-a send-prefix
# First Index of Windows
set -g base-index 1
# First Index of Panes
setw -g pane-base-index 1
# History Buffer
set -g history-limit 10000
# Mouse Support
# WARN: It disable `selection-copy` on iTerm.
# Must press `opt` & select by mouse for `selection-copy`.
set -g mouse on
# WARN: There is a bug for these configs.
# Only available after switching to another app using the mouse!
bind-key -T copy-mode-vi MouseDown1Pane select-pane
bind-key -T copy-mode-vi MouseDrag1Pane select-pane \; send-keys -X begin-selection
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-selection
#bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-selection-and-cancel
bind-key -T copy-mode-vi 'c' send-keys -X copy-selection
# Terminal Color Mode
set -g default-terminal "screen-256color"
# Colors of CLI & Msg
set -g message-fg white
set -g message-bg black
set -g message-attr bright
# Colors of Window Status
setw -g window-status-current-fg white
setw -g window-status-current-bg black
setw -g window-status-current-attr bright
# Colors of Active Pane or else
set -g pane-border-fg magenta
set -g pane-border-bg black
set -g pane-active-border-fg white
set -g pane-active-border-bg black
# Colors of Status Bar
set -g status-fg red
set -g status-bg black
# Content & Colors of left part of Status Bar
set -g status-left-length 40
set -g status-left "#[fg=white]s#S w#I p#P"
# Content & Colors of right part of Status Bar
# 15% | 28 Nov 18:15
set -g status-right "#[fg=white]%d %b %R"
# Refresh Status Bar per 60s
set -g status-interval 60
# Display Window List at the Centre
set -g status-justify centre
# Prevent misoperation about 'Pf, o'
unbind o
# Reload Prefix
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# New Window
bind c new-window -c "#{pane_current_path}"
# Split Window
#bind \ split-window -h
#bind - split-window -v
bind \ split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
#bind \ send-keys "/Users/IceHe/.tmux-panes -h" C-m
#bind - send-keys "/Users/IceHe/.tmux-panes -v" C-m
# Move to Pane
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Resize Pane
bind -r ^y resizep -L 5 # to the left (prefix Ctrl+h)
bind -r ^u resizep -D 5 # downward (prefix Ctrl+j)
bind -r ^i resizep -U 5 # upward (prefix Ctrl+k)
bind -r ^o resizep -R 5 # to the right (prefix Ctrl+l)
# Manipulate as vi-mode in copy-mode
setw -g mode-keys vi
# Select (v)
bind-key -T copy-mode-vi 'v' send -X begin-selection
# Copy (y)
#bind-key -T copy-mode-vi 'y' send -X copy-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
bind-key -T copy-mode-vi 'u' send -X copy-selection-and-cancel
bind-key -T copy-mode-vi 'Y' send -X copy-selection-and-cancel
#bind-key -T copy-mode-vi 'Y' send -X copy-line
#unbind-key -T copy-mode-vi 'Y'
# 'D' : copy-to-end-of-line
# Fix Clipboard on macOS
# (must disable on other OS)
set-option -g default-command "reattach-to-user-namespace -l ${SHELL}"
# Pane Maximize & Minimize
unbind M
bind M new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
unbind m
bind m last-window \; swap-pane -s tmp.1 \; kill-window -t tmp