dotfiles/config/tmux/tmux.conf

133 lines
4.8 KiB
Bash

set -g prefix C-space
#
# Key bindings
#
bind C-space send-prefix
bind r source-file "$XDG_CONFIG_HOME/tmux/tmux.conf" \; display "RELOADED"
# Window/pane management (new windows/panes use the path in current pane)
bind c new-window -c '#{pane_current_path}'
bind | split-window -h -c '#{pane_current_path}'
bind - split-window -v -c '#{pane_current_path}'
bind x kill-pane
bind X kill-window
bind n command-prompt 'rename-window %%'
bind N command-prompt 'rename-session %%'
# Move around
bind -r . next-window
bind -r , previous-window
bind -r C-h select-pane -L
bind -r C-j select-pane -D
bind -r C-k select-pane -U
bind -r C-l select-pane -R
# Resize panes
bind -r h resize-pane -L 1
bind -r j resize-pane -D 1
bind -r k resize-pane -U 1
bind -r l resize-pane -R 1
# Arrangement of panes
bind b break-pane \; select-pane -m \; last-window
bind J join-pane -v
bind L join-pane -h
# Choosing layouts
bind -r C-o rotate-window
bind -r C-i rotate-window -D
bind -r space next-layout
bind C-m set main-pane-width 50% \; select-layout main-vertical
bind C-e select-layout even-horizontal
bind C-t select-layout tiled
# Stay in copy mode on drag end
unbind-key -T copy-mode-vi MouseDragEnd1Pane
#
# General
#
set -gs escape-time 50 # avoid delays with ESC in vim
set -gs repeat-time 1000 # allow 1 second for multiple commands
set -g base-index 1 # start window numbering from 1
set -g history-limit 20000 # remember longer history
setw -g automatic-rename on # automatically rename windows
setw -g mouse on # enable mouse support
setw -g pane-base-index 1 # start pane numbering from 1
# Set $TERM, force 256 colors, and enable italics.
# https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-a-256-colour-terminal
# https://github.com/tmux/tmux/wiki/FAQ#i-dont-see-italics-or-italics-and-reverse-are-the-wrong-way-round
set -g default-terminal 'tmux-256color'
# Report true color support to programs.
# https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-rgb-colour
set -ga terminal-overrides ',*-256col*:Tc'
# The shell will increment SHLVL by one when it is started -> unsetting this
# variable here removes any memory of nesting before tmux was executed and will
# cause shells to start with level 1 again within the session.
set-environment -gu SHLVL
# Fix for clipboard in vim running inside tmux:
# See http://www.economyofeffort.com/2013/07/29/reattach-to-user-namespace-the-fix-for-your-tmux-in-os-x-woes/
# See http://stackoverflow.com/a/40154047
# See https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
if-shell 'test "$(uname)" = "Darwin"' \
'set -g default-command "reattach-to-user-namespace -l $SHELL"'
#
# Style (status list, colors, ...)
#
# Color definitions
# SOLARIZED TMUX SOLARIZED TMUX
# --------- -------- --------- --------
# Base04 n/a (#002028)
# Base03 colour8 Yellow colour3
# Base02 colour0 Orange colour9
# Base01 colour10 Red colour1
# Base00 colour11 Magenta colour5
# Base0 colour12 Violet colour13
# Base1 colour14 Blue colour4
# Base2 colour7 Cyan colour6
# Base3 colour15 Green colour2
set -g status-left-length 48
set -g status-right-length 48
set -g status-justify centre
set -g status-left '\
#{?client_prefix,#[fg=colour1],#[fg=colour10]}#[push-default] \
 #[fg=colour3]#{session_name}#[default] \
囹#[fg=colour2]#{window_index}.#{pane_index}#[default] \
笠#[fg=colour6]#{pane_id} #{?pane_marked,#[fg=colour9], }#[default]'
set -g status-right '\
#{?client_prefix,#[fg=colour1],#[fg=colour10]}#[push-default]\
 #[fg=colour6]#{pid}#[default] \
歷#[fg=colour2]#{host_short}#[default] \
 #[fg=colour3]%b %d %H:%M '
setw -g window-status-current-format '#[fg=colour8]\
#[fg=colour0]#{window_index} \
#[default italics fg=colour4]#{window_name}\
#[fg=colour10]#{window_flags}\
#[fg=colour8]'
setw -g window-status-format '\
#{?client_prefix,#[bold fg=colour1],#[fg=colour10]}#{window_index} \
#[default]#{window_name}\
#[fg=colour10]#{window_flags}'
set -g status-style fg=colour14,bg=colour8
setw -g window-status-style fg=default,bg=default
setw -g window-status-current-style fg=default,bg=#002028
set -g pane-border-style fg=colour0
set -g pane-active-border-style fg=colour10
set -g message-style fg=colour15,bg=colour0
set -g message-command-style fg=colour3,bg=colour0