dotfiles/config/tmux/tmux.conf

108 lines
4 KiB
Bash

#
# Key bindings
#
set -g prefix C-space
bind C-space send-prefix
# Open new windows/panes with 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 r source-file "$XDG_CONFIG_HOME/tmux/tmux.conf"
bind . next-window
bind , previous-window
bind n command-prompt 'rename-window %%'
bind N command-prompt 'rename-session %%'
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind -r C-h resize-pane -L 5
bind -r C-j resize-pane -D 5
bind -r C-k resize-pane -U 5
bind -r C-l resize-pane -R 5
unbind-key -T copy-mode-vi MouseDragEnd1Pane # Stay in copy mode on drag end
#
# General
#
set -gs escape-time 50 # avoid delays with ESC in vim
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 and force 256 colors.
# https://github.com/tmux/tmux/wiki/FAQ#how-do-i-use-a-256-colour-terminal
set -g default-terminal 'screen-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, ...)
#
set -g status-left-length 32
set -g status-right-length 48
set -g status-justify centre
# Color definitions
# SOLARIZED TMUX
# --------- --------
# Base03 colour8
# Base02 colour0
# Base01 colour10
# Base00 colour11
# Base0 colour12
# Base1 colour14
# Base2 colour7
# Base3 colour15
# Yellow colour3
# Orange colour9
# Red colour1
# Magenta colour5
# Violet colour13
# Blue colour4
# Cyan colour6
# Green colour2
set -g status-left "\
#{?client_prefix,#[fg=colour1],#[fg=colour10]}\
#[push-default,fg=colour3]#{session_name} #[pop-default,default]> \
#[push-default,fg=colour2]#{window_index}.#{pane_index} #[pop-default,default]> \
#[push-default,fg=colour6]#{pane_id} #{?pane_marked,#[fg=colour9](M),}"
set -g status-right "\
#{?client_prefix,#[fg=colour1],#[fg=colour10]}\
#[push-default,fg=colour6]#{pid} #[pop-default,default]< \
#[push-default,fg=colour2]#{host_short} #[pop-default,default]< \
#[push-default,fg=colour3]%b %d %H:%M"
setw -g window-status-current-format "#{window_index}:#{window_name}#{window_flags} "
setw -g window-status-format "#{window_index}:#{window_name}#{window_flags} "
set -g status-style bg=colour0 # ... on Base02
setw -g window-status-style fg=colour12,bg=default # Base0 on Transparent
setw -g window-status-current-style fg=colour4,bg=default # Blue on Transparent
set -g pane-border-style fg=colour0 # Base02
set -g pane-active-border-style fg=colour14 # Base1
set -g message-style fg=colour0,bg=colour14
set -g message-command-style fg=colour0,bg=colour14