aboutsummaryrefslogtreecommitdiffstats
path: root/_tmux.conf
blob: cceb40395357c6e57e795ac9b8cf7c44613bdbf8 (plain)
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
127
128
129
130
131
132
133
134
##
## ~/.tmux.conf
##
## Aaron LI
## Created: 2015-01-22
## Updated: 2016-07-26
##
## References:
## [1] tmux: Productive Mouse-Free Development (by Brian P. Hogan)
##     https://pragprog.com/book/bhtmux/tmux
## [2] Making tmux Pretty and Usable - A Guide to Customizing your tmux.conf
##     http://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/
## [3] ArchWiki - Tmux
##     https://wiki.archlinux.org/index.php/tmux
## [4] Practical Tmux
##     http://mutelight.org/practical-tmux
## [5] Tmux Plugin Manager
##     https://github.com/tmux-plugins/tpm
## [6] Tmux themepack
##     https://github.com/jimeh/tmux-themepack
##


## 'C-b' is not acceptable: Vim uses it!
unbind-key C-b
set-option -g prefix C-a

## Start window numbering at 1
set-option -g base-index 1

## Renumber the windows when a window is closed
set-option -g renumber-windows on

## Start pane numbering at 1
set-window-option -g pane-base-index 1

# URxvt tab like window control
bind-key -n S-Down  new-window
bind-key -n S-Left  previous-window
bind-key -n S-Right next-window
bind-key -n C-Left  swap-window -t -1
bind-key -n C-Right swap-window -t +1

## Detach tmux instead of exit
bind-key -n C-d detach

## Mouse control (>= v2.1)
set-option -g mouse on
bind-key m set-option -g mouse on  \; display "Mouse: ON"
bind-key M set-option -g mouse off \; display "Mouse: OFF"

## Terminal settings
# Override terminal's default Cr (color reset) to avoid the strange
# 'char+112' when just exited the tmux session.
# Credit: https://github.com/tmux/tmux/issues/266
set-option -g terminal-overrides ',xterm*:Cr=\E]12;gray\007'

## Maximize and restore a pane
unbind-key Up
bind-key Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
unbind-key Down
bind-key Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp

## Log output to a text file on demand
bind-key P pipe-pane -o "cat >> ~/#W.log" \; display "Toggled logging to ~/#W.log"


###### Appearance ######

## Panes
set-option -g pane-border-style        "fg=default,bg=default"
set-option -g pane-active-border-style "fg=blue,bg=default"

## Status bar design
# status line
set-option -g status-justify      centre
set-option -g status-left-length  20
set-option -g status-right-length 20
set-option -g status-style        "bg=default,bold"
set-option -g status-left         " #[fg=yellow]#h:#[fg=blue]#S #[fg=magenta]>>#[default]"
set-option -g status-right        "#[fg=magenta]<< #[fg=yellow]%a %m/%d #[fg=blue]%H:%M "

# window status
set-option -g window-status-separator             " "
set-window-option -g window-status-style          "fg=blue,bold"
set-window-option -g window-status-current-style  "fg=blue,bold,reverse"
set-window-option -g window-status-bell-style     "fg=red,bold"
set-window-option -g window-status-format         "#I:#{=10:window_name}#F"
set-window-option -g window-status-current-format "#[fg=yellow]#I:#[fg=blue]#W#[fg=green]#F#[default]"

# window mode
set-window-option -g mode-style        "fg=yellow,bg=default,bold"
set-window-option -g clock-mode-colour yellow
set-window-option -g clock-mode-style  24

# messaging
set-option -g message-style         "fg=white,bg=blue,bold"
set-option -g message-command-style "fg=white,bg=default,bold"

# loud or quiet?
set-option -g visual-activity off
set-option -g visual-bell     off
set-option -g visual-silence  off
set-option -g bell-action     none
set-window-option -g monitor-activity off


###### Tmux Plugins ######

# List of plugins
set-option -g @plugin "tmux-plugins/tpm"
# Basic tmux settings everyone can agree on
set-option -g @plugin "tmux-plugins/tmux-sensible"
# Persists tmux environment across system restarts
set-option -g @plugin "tmux-plugins/tmux-resurrect"
# Copy to system clipboard
set-option -g @plugin "tmux-plugins/tmux-yank"
# Enhance tmux search
set-option -g @plugin "tmux-plugins/tmux-copycat"
# Continuous saving of tmux environment
set-option -g @plugin "tmux-plugins/tmux-continuum"
# Standard pane key-bindings for tmux
set-option -g @plugin "tmux-plugins/tmux-pain-control"
# Tmux key bindings for quick opening of a highlighted file or URL
set-option -g @plugin "tmux-plugins/tmux-open"

# Automatic TPM installation
# Credit: https://github.com/tmux-plugins/tpm/blob/master/docs/automatic_tpm_installation.md
if "test ! -d ~/.tmux/plugins/tpm" \
   "run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm'"

# Initialize Tmux plugin manager (keep this at the very bottom)
run "~/.tmux/plugins/tpm/tpm"