-
Notifications
You must be signed in to change notification settings - Fork 3
/
tmux.conf
156 lines (124 loc) · 4.18 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# ##############################
# Upply this file with:
# tmux source-file ~/.tmux.conf
#
# Use ` as pefix. Double ` prints one `
unbind C-b
set -g prefix `
bind ` send-prefix
# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1
# Enable ctrl+arrow inside tmux
set-window-option -g xterm-keys on
# Set scrollback buffer size
set -g history-limit 50000
# Set the default $TERM
set -g default-terminal screen-256color
# Set window title string
set -g set-titles on
set -g set-titles-string \
'#{?#{==:#{pane_current_command},zsh},,• }#{pane_current_path}: #{pane_title}'
setw -g automatic-rename
# Show only date and time on the right of status bar
set-option -g status-interval 1
set -g status-right-length 60
set -g status-right "%a %Y-%m-%d %H:%M"
# Tab format: `1:zsh* 2:zsh`
setw -g window-status-format '#I:#{pane_current_command}#F'
setw -g window-status-current-format '#I:#{pane_current_command}#F'
# Set status color to red if root
if-shell "[ 0 -eq $(ps -o euid= -p $$) ]" {
set -g status-bg "red"
} {
set -g status-bg "green"
}
# set -g pane-border-format "#P: #{pane_current_command}"
# Vi copypaste mode
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
# # hjkl / vi-like pane traversal
# bind h select-pane -L
# bind j select-pane -D
# bind k select-pane -U
# bind l select-pane -R
bind m set-window-option main-pane-height 30\; \
select-layout main-horizontal
# bind-key a display-message "#{W:#{E:window-status-format} ,#{E:window-status-current-format} }"
# bind-key a display-message "#{client_name}"
# bind-key q display-message "${sync_colour}"
# bind-key a display-message "#{?{==:#(ps -o user= -p #{client_pid}),root},AAA,BBB}"
# bind-key a display-message "#{window-status-current-format}"
# set-option -g status-right '"#{=21:pane_title}" #{cpu_percentage} %H:%M %d-%b-%y'
set -g status-interval 2
# set -g status-right '#(powerline tmux right)'
# %if '#{?#{==:#(ps -o user= -p #{client_pid}),root},,}'
# set -g status-style bg=red
# %else
# set -g status-style bg=blue
# %endif
# %if "#{==:#{host},myhost}"
# set -g status-style bg=red
# %else
# set -g status-style bg=blue
# %endif
# ######
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
# ######
# A set of tmux options that should be acceptable to everyone
set -g @plugin 'tmux-plugins/tmux-sensible'
# ######
# Plugin that highlights when you press tmux prefix key
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g status-right '#{prefix_highlight} | %a %Y-%m-%d %H:%M'
# ######
# Restore tmux environment after system restart
# Keys:
# * prefix + Ctrl-s - save
# * prefix + Ctrl-r - restore
set -g @plugin 'tmux-plugins/tmux-resurrect'
# ######
# Features:
# * continuous saving of tmux environment
# * automatic tmux start when computer/server is turned on
# * automatic restore when tmux is started
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'off'
# ######
# Complete commands with text already on screen
# Keys:
# * prefix + Tab - start
# * prefix + f - filter
# * Tab - insert to current pane
# * Enter - copy to clipboard
%if "command -v fzf python3 bash"
set -g @plugin 'laktak/extrakto'
%endif
# ######
# Open a url in browser
# Keys:
# * prefix + u - pick url and open
%if "command -v fzf bash"
set -g @plugin 'wfxr/tmux-fzf-url'
%endif
# ######
# Yank to both tmux internal buffer and the clipboard
set -g @plugin 'tmux-plugins/tmux-yank'
# set -g @plugin 'thewtex/tmux-mem-cpu-load'
# set -g @plugin 'tmux-plugins/tmux-cpu'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin '[email protected]/user/plugin'
# set -g @plugin '[email protected]/user/plugin'
# set -g @plugin 'jabirali/tmux-tilish'
# set -g @plugin 'tmux-plugins/tmux-sidebar'
# Automatic tpm installation
%if "[ ! -d ~/.tmux/plugins/tpm]"
run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm'
%endif
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
if-shell "env |grep '^TMUX=' |grep -q /tmate" {
} { run '~/.tmux/plugins/tpm/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'
}