dotfiles/config/tmux/tmux.conf

126 lines
4.7 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"
bind v copy-mode
bind p paste-buffer
bind C command-prompt -p 'Save pane history:' \
-I '~/tmux.history' \
'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'
# 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 W command-prompt 'rename-window %%'
bind S command-prompt 'rename-session %%'
bind s set synchronize-panes
# Move around
bind . next-window
bind , previous-window
bind / last-window
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Resize panes
bind -r C-h resize-pane -L 2
bind -r C-j resize-pane -D 2
bind -r C-k resize-pane -U 2
bind -r C-l resize-pane -R 2
# Arrangement of panes & windows
bind b break-pane \; select-pane -m \; last-window
bind H join-pane -h -b
bind J join-pane -v
bind K join-pane -v -b
bind L join-pane -h
bind -r > swap-window -d -t :+
bind -r < swap-window -d -t :-
# 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
# Copy mode
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-selection
unbind -T copy-mode-vi MouseDragEnd1Pane # Stay in copy mode on drag end.
#
# General
#
set -s focus-events on # pass focus events from terminal to applications
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, ...)
#
set -g status-left ' '
set -g status-right '\
#[fg=brightblack] \
#{?client_prefix,#[fg=brightyellow],#[fg=brightblack]}#{pane_id}\
#[fg=brightblack]  \
#{?client_prefix,#[fg=brightyellow],#[fg=brightblack]}#{session_name}\
#[fg=brightblack]  \
#{?client_prefix,#[fg=brightyellow],#[fg=brightblack]}#{host_short} '
setw -g window-status-current-format '\
#{?client_prefix,#[fg=brightyellow],#[fg=brightcyan]}#{window_index} \
#[fg=brightblue]#{window_name} \
#{?client_prefix,#[fg=brightyellow],#[fg=brightcyan]}\
#{?pane_synchronized,󰵉 ,}#{?window_marked_flag,󰄵 ,}#{?window_zoomed_flag, ,}\
#[fg=brightblack]'
setw -g window-status-format '\
#{?client_prefix,#[fg=brightyellow],#[fg=brightblack]}#{window_index} \
#[fg=brightblack]#{window_name} \
#{?pane_synchronized,󰵉 ,}#{?window_marked_flag,󰄵 ,}#{?window_zoomed_flag, ,}\
#[fg=brightblack]'
set -g status-justify left
set -g status-style fg=white,bg=black
set -g pane-border-style fg=black
set -g pane-active-border-style fg=brightblack
set -g message-style fg=brightwhite,bg=black
set -g message-command-style fg=yellow,bg=black