101 lines
3.1 KiB
Plaintext
101 lines
3.1 KiB
Plaintext
## Behavior ###############
|
|
# Zero-based indexing is fine in programming languages, but not so much in
|
|
# a multiplexer when zero is on the other side of the keyboard.
|
|
set -g base-index 1
|
|
set -g renumber-windows on
|
|
setw -g automatic-rename on
|
|
# status bar
|
|
set-option -g status-utf8 on
|
|
# Remove the <C-a> delay
|
|
set -s escape-time 0
|
|
# Rather than constraining window size to the maximum size of any client
|
|
# connected to the *session*, constrain window size to the maximum size of any
|
|
# client connected to *that window*. Much more reasonable.
|
|
setw -g aggressive-resize off
|
|
# go zsh, go
|
|
set-option -g default-shell $SHELL
|
|
# a mouse
|
|
setw -g mouse-utf8 on
|
|
setw -g mouse on
|
|
# fix mouse scrolling: enter copy mode on scroll-up, exits it when scrolled to bottom
|
|
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
|
|
|
|
## Key bindings ###########
|
|
# Remap the key prefix
|
|
set -g prefix C-c
|
|
unbind C-b
|
|
# Restore sigterm C-c
|
|
bind C-c send-prefix
|
|
# Go to last active window
|
|
bind-key a last-window
|
|
# reload config without killing server
|
|
bind r source-file ~/.tmux.conf \; display-message " Config reloaded..".
|
|
# set vi keys
|
|
setw -g mode-keys vi
|
|
unbind [
|
|
bind Escape copy-mode
|
|
unbind p
|
|
bind p paste-buffer
|
|
bind-key -t vi-copy 'v' begin-selection
|
|
bind-key -t vi-copy 'y' copy-pipe "reattach-to-user-namespace pbcopy"
|
|
|
|
unbind -t vi-copy Enter
|
|
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
|
|
|
|
## Pane management #####
|
|
# Better splitting keybinds
|
|
unbind %
|
|
unbind '"'
|
|
bind s split-window -v
|
|
bind v split-window -h
|
|
|
|
# Smart pane switching with awareness of vim splits
|
|
# See: https://github.com/christoomey/vim-tmux-navigator
|
|
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(diff)?$"'
|
|
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
|
|
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
|
|
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
|
|
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
|
|
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
|
|
|
|
bind H resize-pane -L 5
|
|
bind J resize-pane -D 5
|
|
bind K resize-pane -U 5
|
|
bind L resize-pane -R 5
|
|
|
|
bind n next-window
|
|
bind p previous-window
|
|
|
|
# Disable confirmation
|
|
bind & kill-window
|
|
bind x kill-pane
|
|
|
|
# after copying to a tmux buffer, hit y again to copy to clipboard
|
|
bind y run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
|
|
# quick view of processes
|
|
bind '~' split-window "exec top"
|
|
|
|
## Looks ########################
|
|
set -g default-terminal "screen-256color"
|
|
|
|
set -g status-bg colour235
|
|
set -g status-fg white
|
|
|
|
set-window-option -g window-status-current-fg black
|
|
set-window-option -g window-status-current-bg yellow
|
|
|
|
set -g pane-border-fg colour235
|
|
set -g pane-border-bg black
|
|
set -g pane-active-border-fg yellow
|
|
set -g pane-active-border-bg black
|
|
|
|
## Status bar ###################
|
|
set-option -g status-justify left
|
|
set-option -g status-right-length 60
|
|
set-option -g status-left-length 60
|
|
set-option -g status-left '#[bg=yellow] #[fg=black]#[bold]#S #[default] '
|
|
set-option -g status-right '#(hostname) '
|
|
|
|
set -g window-status-format "#I. #W"
|
|
set -g window-status-current-format " #I. #W "
|