dotfiles/roles/tmux/files/tmux.conf
Fernando Schauenburg 6b4f2ecf85 fix(tmux): changing background was ignored by tmux
When moving the configuration files to $XDG_CONFIG_HOME I forgot to
change the line in .bashrc that sources the tmux configuration so bash
was still trying to source ~/.tmux.conf, which no longer exists.

This commit fixes that. Additionally, the color setting code has been
factored out of tmux.conf into tmux-colors.conf (which can be sourced
from bash profile and tmux.conf). This way the rest of the code in
tmux.conf doesn't have to be executed again when changing the background
color.
2020-12-04 18:15:41 +01:00

66 lines
2.3 KiB
Bash

#
# Key bindings
#
unbind C-b
set -g prefix C-Space
# 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 -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 ~/.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 -g base-index 1 # start window numbering from 1
set -g default-terminal "screen-256color" # display 256 colors
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
#
# Status bar
#
set -g status-left-length 32
set -g status-right-length 32
set -g status-justify centre
set -g status-left '@#h §#S' # @host §session
set -g status-right '%Y-%m-%d %H:%M' # date time
# 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
#
# Colors
#
source-file -q "$XDG_CONFIG_HOME/tmux/tmux-colors.conf"
# 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"'