/
tmux.conf
153 lines (116 loc) · 4.47 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
# This tmux configuration was compiled from multiple sources.
# A couple of the sources are not here.
#
# Source: https://gist.github.com/terrywang/3950393
# Based on tmux book written by Brian P. Hogan
# c-a o to switch to another panel
# c-d to close shell
# c-a ! to close panel
# c-a w to list windows
# c-a " split pane horizontally
# c-a % split pane vertically
# Setting the prefix from C-b to C-a
set -g prefix C-a
# Free the original Ctrl-b prefix keybinding
unbind C-b
# Setting the delay between prefix and command
set -s escape-time 1
# Ensure that we can send Ctrl-a to other apps
bind C-a send-prefix
# readline beginning-of-line behaviour Ctrl-a a
bind a send-prefix
# history buffer - max number of lines for each window
set -g history-limit 100000
# Set Terminal Emulator Titles - OFF by default
# set -g set-titles on
# Set the base index for windows to 1 instead of 0
set -g base-index 1
# Set the base index for panes to 1 instead of 0
setw -g pane-base-index 1
# Switch to last window
unbind l
bind-key C-a last-window
# unbind o
# bind-key C-a select-pane
# Reload the file with Prefix r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# Splitting panes replace % and "
# bind | split-window -h
# bind - split-window -v
# moving between panes
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Quick pane selection
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# Pane resizing
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Mouse support
# setw -g mode-mouse on
# set -g mouse-select-pane off
# set -g mouse-resize-pane off
# set -g mouse-select-window off
# incompatible since tmux 2.1
set -g mouse on
# Set the default terminal mode to 256color mode
set -g default-terminal "screen-256color"
# Enable activity alerts
setw -g monitor-activity on
set -g visual-activity on
# tmux coloring
# Set the status line's colors
#set -g status-style fg=white,bg=colour27
set -g status-style fg=white,bg=black
# Set the color of the window list
setw -g window-status-style fg=cyan,bg=default,dim
# Set colors for the active window
setw -g window-status-current-style fg=white,bg=red,bright
# Pane colors
set -g pane-border-style fg=green,bg=black
set -g pane-active-border-style fg=white,bg=yellow
# Command / message line
set -g message-style fg=white,bg=black,bright
# Status line left side
set -g status-left-length 40
set -g status-left "#[fg=green]Session: #S #[fg=yellow]W#I #[fg=cyan]P#P"
# No longer necessary since tmux 2.1
# set -g status-utf8 on
# Status line right side
# 15% | 25 Oct 14:50
set -g status-right "#[fg=cyan]%d %b %R #[fg=magenta]#H"
# Update the status bar every sixty seconds
set -g status-interval 60
# Center the window list
set -g status-justify centre
# Enable vi keys
setw -g mode-keys vi
bind-key j command-prompt -p "Join pane from:" "join-pane -s '%%'"
bind-key s command-prompt -p "Send pane to:" "join-pane -t '%%'"
# Absolute paths will depend on if you are using root or not.
# set -g @logging-path '/home/USERNAME/tmux_logs'
set -g @logging-path '/root/tmux_logs'
set -g @logging-filename "%Y-%m-%d_#{session_name}-#{window_index}-#{pane_index}.log"
set -g allow-rename off
# For extra plugins.
# Source: https://www.seanh.cc/2020/12/27/copy-and-paste-in-tmux/
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-logging'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @yank_action 'copy-pipe-no-clear'
bind -T copy-mode C-c send -X copy-pipe-no-clear "xsel -i --clipboard"
bind -T copy-mode-vi C-c send -X copy-pipe-no-clear "xsel -i --clipboard"
# Double-click and triple-click
bind -T copy-mode DoubleClick1Pane select-pane \; send -X select-word \; send -X copy-pipe-no-clear "xsel -i"
bind -T copy-mode-vi DoubleClick1Pane select-pane \; send -X select-word \; send -X copy-pipe-no-clear "xsel -i"
bind -n DoubleClick1Pane select-pane \; copy-mode -M \; send -X select-word \; send -X copy-pipe-no-clear "xsel -i"
bind -T copy-mode TripleClick1Pane select-pane \; send -X select-line \; send -X copy-pipe-no-clear "xsel -i"
bind -T copy-mode-vi TripleClick1Pane select-pane \; send -X select-line \; send -X copy-pipe-no-clear "xsel -i"
bind -n TripleClick1Pane select-pane \; copy-mode -M \; send -X select-line \; send -X copy-pipe-no-clear "xsel -i"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
# /home/USERNAME/plugins/tpm/tpm if you are not using root.
run '/root/.tmux/plugins/tpm/tpm'