-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
123 lines (92 loc) · 3.59 KB
/
.tmux.conf
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
# bind -> bind-key
# set -> set
# setw -> set-window-option
# unbind -> unbind-key
# Full version (e.g., 2.9a)
run-shell "tmux setenv -g TMUX_FULL_VERSION $(tmux -V | cut -c 6-)"
# Version (e.g., 2.9)
run-shell "tmux setenv -g TMUX_VERSION $(tmux -V | sed 's/[^0-9.]//g')"
# --- Options ---
# Required for tmux < 2.2
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.2" | bc)" = 1 ]' " \
set -gq status-utf8 on \
set -gq utf8 on"
# Window base index
set -g base-index 1
# Pane base index
setw -g pane-base-index 1
# Input escape immediately [ms]
set -sg escape-time 1
# Increase scrollback buffer
set -g history-limit 50000
# Enable focus events
set -g focus-events on
# Use mouse
#set -g mode-mouse on
#set -g mouse-utf8 on
#set -g mouse-resize-pane on
#set -g mouse-select-pane on
#set -g mouse-select-window on
# 256 Color
set -g default-terminal screen-256color
# --- / Options ---
# --- Key Bindings ---
# Change prefix key
unbind C-b
set -g prefix C-t
bind C-t send-prefix
# Vi-like key bindings
setw -g mode-keys vi
# tmux < 2.4
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.4" | bc)" = 1 ]' " \
bind -t vi-copy v begin-selection \
bind -t vi-copy y copy-selection"
# tmux >= 2.4
if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.4" | bc)" = 1 ]' " \
bind -T copy-mode-vi v send -X begin-selection \
bind -T copy-mode-vi y send -X copy-selection"
if-shell '[[ $OSTYPE =~ darwin ]]' "bind -T copy-mode-vi y send -X copy-pipe-and-cancel 'pbcopy'"
if-shell '[[ $OSTYPE =~ darwin ]]' "bind -T copy-mode-vi Enter send -X copy-pipe-and-cancel 'pbcopy'"
if-shell '[[ $OSTYPE =~ linux-gnu ]]' "bind -T copy-mode-vi y send -X copy-pipe-and-cancel 'xsel --clipboard --input'"
if-shell '[[ $OSTYPE =~ linux-gnu ]]' "bind -T copy-mode-vi Enter send -X copy-pipe-and-cancel 'xsel --clipboard --output'"
# Conflicts with tmux-resurrect
# Reload configuration file (Prefix + Ctrl-r)
# bind C-r source-file ~/.tmux.conf
# Repeat resize-pane
bind -r Up resize-pane -U
bind -r Down resize-pane -D
bind -r Left resize-pane -L
bind -r Right resize-pane -R
bind -r k resize-pane -U
bind -r j resize-pane -D
bind -r h resize-pane -L
bind -r l resize-pane -R
# --- / Key Bindings ---
# --- Status Line ---
# Powerline-like
set -g status-bg colour234
set -g status-fg colour231
set -g status-left "#{?client_prefix,#[fg=colour254]#[bg=colour31]#[bold],#[fg=black]#[bg=colour254]#[bold]} #S #[default] "
set -g status-left-length 20
set -g status-right "#[fg=colour247,bg=colour234,bold] #(tmux show-options -g prefix | cut -d ' ' -f 2) #[fg=colour249,bg=colour235,nobold] %Y-%m-%d %H:%M #[fg=black,bg=colour252,bold] #h "
setw -g window-status-style fg="colour249"
setw -g window-status-format "#[fg=colour244,bg=colour234] #I #[default]#W "
setw -g window-status-current-format "#[fg=colour117,bg=colour31] #I #[fg=colour231,bold]#W "
setw -g window-status-last-style fg="colour31"
# --- / Status Line ---
# --- Others ---
# Keep current directory on split-window
bind % split-window -h -c '#{pane_current_path}'
bind '"' split-window -v -c '#{pane_current_path}'
# Sync tmux buffer with OS X
# Prefix + Ctrl-c / v
if-shell '[[ $OSTYPE =~ darwin ]]' "bind C-c run 'tmux save-buffer - | pbcopy'"
if-shell '[[ $OSTYPE =~ darwin ]]' "bind C-v run 'pbpaste | tmux load-buffer - && tmux paste-buffer'"
# --- / Others ---
# --- Plugins ---
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# Run `git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm`, if you want to use tpm
if-shell '[[ -e ~/.tmux/plugins/tpm/tpm ]]' "run '~/.tmux/plugins/tpm/tpm'"
# --- / Plugins ---