aboutsummaryrefslogtreecommitdiff
path: root/tmux/tmux.conf
blob: 053921b3db4c6ab78340b32895887c6bc887c128 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Don't update the environment from anywhere; too confusing
set-option -g update-environment ''

# Setting this makes each new pane a non-login shell, which suits me better
set-option -g default-command "exec $SHELL"

# Expect a 256-color terminal
set-option -g default-terminal 'screen-256color'

# Change the prefix to ^A rather than the default of ^B, because I'm a godless
# GNU Screen refugee, and also I like using ^B in my shell and in Vim more
unbind-key C-b
set-option -g prefix C-a
bind-key a send-prefix

# Repeating the prefix switches to the last window and back, a GNU Screen
# feature that's hardwired into my brain now
bind-key C-a last-window

# Quick ways to kill single windows and the whole server
bind-key '/' confirm-before 'kill-window'
bind-key "\\" confirm-before 'kill-server'

# Slightly more intuitive way to split windows
bind-key '_' split-window -v
bind-key '|' split-window -h

# Switch to the last active pane
bind-key Tab last-pane

# Use the vi mode for tmux interaction behaviour in copy and choice modes
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi y send -X copy-selection-and-cancel

# Detach with Alt-M, no prefix required
bind-key -n M-m detach

# Vim-like pane resizing
bind-key -r '+' resize-pane -U 5
bind-key -r '-' resize-pane -D 5
bind-key -r '<' resize-pane -L 5
bind-key -r '>' resize-pane -R 5

# Vim-like pane switching
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R

# Join and break panes
bind-key J choose-window 'join-pane -h -s "%%"'
bind-key B break-pane -d

# Select only sessions in the choose-tree menu, not the whole tree of sessions
# and windows, I prefer to drill down
bind-key s choose-session

# Session title on the left side of the status bar
set-option -g status-left '[#S] '

# Username, hostname, and the current date on the right side of the status bar
set-option -g status-right ' (mail:#(msc)) [#h] %F %T'

# Update the status bar every second
set-option -g status-interval 1

# The first window in a session has index 1, rather than 0
set-option -g base-index 1

# Don't worry about timeouts for key combinations, as I don't use Escape as
# meta and prefer things to be snappier
set-option -g escape-time 0

# Don't interfere with my system clipboard
set-option -g set-clipboard off

# Only force individual windows to the smallest attached terminal size, not
# whole sessions
set-window-option -g aggressive-resize on

# If I don't set a title on a window, use the program name for the window title
set-window-option -g automatic-rename on

# However, don't let terminal escape sequences rename my windows
set-window-option -g allow-rename off

# Window titles are the window index, a colon, the window or command name, and
# any activity or alert indicators
set-window-option -g window-status-format '#I:#W#F'

# Message dialogs are white on blue
set-option -g message-style 'bg=colour18,fg=colour231'

# Window choosers are white on blue
set-window-option -g mode-style 'bg=colour18,fg=colour231'

# Pane borders are always in the background color
set-option -g pane-border-style 'fg=colour237'
set-option -g pane-active-border-style 'fg=colour237'

# Inactive windows have slightly washed-out system colours
set-option -g window-style 'bg=colour232,fg=colour248'
set-option -g window-active-style 'bg=colour0,fg=colour15'

# The status bar has the defined background and foreground colours
set-option -g status-style 'bg=colour237,fg=colour248'

# Titles of windows default to black text with no embellishment
set-window-option -g window-status-style 'fg=colour16'

# The title of the active window is in white rather than black
set-window-option -g window-status-current-style 'fg=colour231'

# A window with a bell has a title with a red background until cleared
set-window-option -g window-status-bell-style 'bg=colour9'

# Source any configuration in the subdir if there is any
source-file -q ~/.tmux.conf.d/*.conf