summaryrefslogtreecommitdiff
path: root/tmux.conf
blob: f8655bd77472b05684065e4c8f3dbe58bdbf4bfa (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
120
121
122
123
124
125
126
# dotfiles -- tmux.conf
# author: johannst


# determine tmux version
run-shell 'tmux setenv -g TMUX_VERSION $(tmux -V | awk "{print $2}" | sed "s/[^0-9.]*//g")'


### Basic Settings

# default TERM
set -g default-terminal "screen-256color"

# re-map prefix key
set -g prefix C-s

# terminate tmux
bind-key C-q confirm-before -p "kill tmux? (y/n)" kill-window

# re-source tmux.conf
bind-key r source-file ~/.tmux.conf

# mouse support
setw -g mouse on

# resolved key forwarding problem
set-window-option -g xterm-keys on

# had some struggle with vim key delay
set -s escape-time 0

# toggle last two windows
bind-key Tab last-window

# split settings
bind-key v split-window -h -c "#{pane_current_path}"
bind-key s split-window -c "#{pane_current_path}"

# maximize current pane
bind-key f resize-pane -Z  # overwrites find window

# move between splits
bind-key k select-pane -U
bind-key j select-pane -D
bind-key h select-pane -L
bind-key l select-pane -R

# resize splits
bind-key -r C-k resize-pane -U
bind-key -r C-j resize-pane -D
bind-key -r C-h resize-pane -L
bind-key -r C-l resize-pane -R

# Copy mode settings
set-window-option -g mode-keys vi
if-shell -b '[ $(echo "$TMUX_VERSION < 2.4" | bc) -eq 1 ]' {
	bind-key -t vi-copy v begin-selection
	bind-key -t vi-copy y copy-selection
	bind-key -t vi-copy C-a start-of-line
	bind-key -t vi-copy C-e end-of-line
}
if-shell -b '[ $(echo "$TMUX_VERSION >= 2.4"| bc) -eq 1 ]' {
	bind-key -T copy-mode-vi v send-key -X begin-selection
	bind-key -T copy-mode-vi y send-key -X copy-selection-and-cancel
	bind-key -T copy-mode-vi C-a send-key -X start-of-line
	bind-key -T copy-mode-vi C-e send-key -X end-of-line
}
bind-key C-b choose-buffer
bind-key C-v copy-mode
bind-key C-p paste-buffer


### Colour Settings

# default statusbar colors
set-option -g status-bg colour235
set-option -g status-fg colour208

# cmd line colors
if-shell -b '[ $(echo "$TMUX_VERSION < 2.9"| bc) -eq 1 ]' {
	set-option -g message-bg colour235
	set-option -g message-fg colour208
}
if-shell -b '[ $(echo "$TMUX_VERSION >= 2.9"| bc) -eq 1 ]' {
	set-option -g message-style 'bg=colour235 fg=colour208'
}

# non-active window title colors
if-shell -b '[ $(echo "$TMUX_VERSION < 2.9"| bc) -eq 1 ]' {
	set-window-option -g window-status-fg colour244
	set-window-option -g window-status-bg default
}
if-shell -b '[ $(echo "$TMUX_VERSION >= 2.9"| bc) -eq 1 ]' {
	set-window-option -g window-status-style 'bg=default fg=colour244'
}

# active window title colors
if-shell -b '[ $(echo "$TMUX_VERSION < 2.9"| bc) -eq 1 ]' {
	set-window-option -g window-status-current-fg colour220
	set-window-option -g window-status-current-bg default
}
if-shell -b '[ $(echo "$TMUX_VERSION >= 2.9"| bc) -eq 1 ]' {
	set-window-option -g window-status-current-style 'bg=default fg=colour220'
}

# pane border
if-shell -b '[ $(echo "$TMUX_VERSION < 2.9"| bc) -eq 1 ]' {
	set-option -g pane-border-fg colour235
	set-option -g pane-active-border-fg colour208
}
if-shell -b '[ $(echo "$TMUX_VERSION >= 2.9"| bc) -eq 1 ]' {
	set-option -g pane-border-style 'fg=colour235'
	set-option -g pane-active-border-style 'fg=colour208'
}

# pane number display
set-option -g display-panes-active-colour colour208
set-option -g display-panes-colour colour244

# right status bar
set-option -g status-right '#H #[fg=colour226,bg=colour239] %d/%m %H:%M '
set-option -g status-right-length 50

# left status bar
set-option -g status-left-length 20