134 lines
3.8 KiB
Plaintext
134 lines
3.8 KiB
Plaintext
## Behavior ###############
|
||
|
||
run-shell "~/.dotfiles/tmux/conf.sh"
|
||
|
||
# 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
|
||
|
||
# address vim mode switching delay (http://superuser.com/a/252717/65504)
|
||
set -g escape-time 0
|
||
|
||
# tmux messages are displayed for 4 seconds
|
||
set -g display-time 2000
|
||
|
||
# go zsh, go
|
||
set -g default-shell $SHELL
|
||
|
||
# set -g visual-activity off
|
||
setw -g monitor-activity on
|
||
|
||
# focus events enabled for terminals that support them
|
||
set -g focus-events on
|
||
|
||
|
||
## Key bindings ###########
|
||
# set vi keys
|
||
setw -g mode-keys vi
|
||
unbind [
|
||
bind Escape copy-mode
|
||
|
||
## Pane management #####
|
||
# Saner splitting commands
|
||
unbind %
|
||
unbind '"'
|
||
bind s split-window -c "#{pane_current_path}" -v
|
||
bind v split-window -c "#{pane_current_path}" -h
|
||
bind c new-window -c "#{pane_current_path}"
|
||
|
||
# break pane into a window
|
||
bind = select-layout even-vertical
|
||
bind + select-layout even-horizontal
|
||
bind - break-pane
|
||
bind _ join-pane
|
||
|
||
# reload config without killing server
|
||
bind r source-file ~/.tmux.conf \; display-message " Config reloaded..".
|
||
bind ^r refresh-client
|
||
|
||
# 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 C-w last-pane
|
||
bind C-n next-window
|
||
bind C-p previous-window
|
||
|
||
# Pane resizing
|
||
bind C-h resize-pane -L 6
|
||
bind C-j resize-pane -D 6
|
||
bind C-k resize-pane -U 6
|
||
bind C-l resize-pane -R 6
|
||
bind -n M-h resize-pane -L 6
|
||
bind -n M-j resize-pane -D 6
|
||
bind -n M-k resize-pane -U 6
|
||
bind -n M-l resize-pane -R 6
|
||
|
||
# Swap panes directionally
|
||
bind h select-pane -L
|
||
bind j select-pane -D
|
||
bind k select-pane -U
|
||
bind l select-pane -R
|
||
bind H run '~/.dotfiles/tmux/swap-pane.sh left'
|
||
bind J run '~/.dotfiles/tmux/swap-pane.sh down'
|
||
bind K run '~/.dotfiles/tmux/swap-pane.sh up'
|
||
bind L run '~/.dotfiles/tmux/swap-pane.sh right'
|
||
bind M run '~/.dotfiles/tmux/swap-pane.sh master'
|
||
|
||
bind o resize-pane -Z
|
||
bind S choose-session
|
||
bind W choose-window
|
||
bind / choose-session
|
||
bind . choose-window
|
||
|
||
bind n run-shell 'TMUX= tmux new-session -t "$(basename \"$PWD\")" -d \; switch-client -t "$(basename \"$PWD\")"'
|
||
bind N run-shell 'TMUX= tmux new-session -t "$(tmux display-message -p #S)" -s "$(tmux display-message -p #S-clone)" -d \; switch-client -n \; display-message "session #S cloned"'
|
||
|
||
# bind = select-layout tiled
|
||
bind | select-layout even-horizontal
|
||
bind _ select-layout even-vertical
|
||
|
||
# switch between sessions
|
||
bind -r [ switch-client -p
|
||
bind -r ] switch-client -n
|
||
|
||
# Disable confirmation
|
||
bind x kill-pane
|
||
bind X kill-window
|
||
bind q kill-session
|
||
bind Q kill-server
|
||
|
||
|
||
## Looks ########################
|
||
set -g set-titles on
|
||
set -g set-titles-string "tmux [#H] #S:#W:#T"
|
||
|
||
set -s default-terminal "xterm-256color"
|
||
|
||
setw -g window-status-fg colour245
|
||
setw -g window-status-bg colour237
|
||
setw -g window-status-current-fg yellow
|
||
setw -g window-status-current-bg black
|
||
setw -g window-status-activity-attr bold,blink
|
||
setw -g window-status-activity-bg colour236
|
||
setw -g window-status-activity-fg white
|
||
|
||
set -g status-interval 30
|
||
set -g status-justify left
|
||
set -g status-right-length 100
|
||
set -g status-left-length 80
|
||
set -g status-left "#($DOTFILES/shell/tmux/scripts/conf-status.sh left) "
|
||
set -g status-right "#($DOTFILES/shell/tmux/scripts/conf-status.sh right) "
|
||
|
||
set -g window-status-format " #I #W:#T "
|
||
set -g window-status-current-format " › #W:#T "
|
||
|
||
####
|
||
run-shell "$DOTFILES/shell/tmux/scripts/prefix_highlight.tmux"
|