-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
141 lines (117 loc) · 4.95 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
# reload while tmux is running will not disable old keybindings, fix it.
# source-file ~/.tmux.reset.conf
# `set` is an alias of `set-option`
# change prefix to `, prefix2 to \
unbind-key C-b
set -g prefix `
bind-key -T prefix ` send-prefix
set -g prefix2 '\'
bind-key -T prefix '\' send-prefix -2
set -g focus-events on
# copy to system clipboard
bind-key -T copy-mode-vi c send-keys -X copy-pipe-and-cancel 'xclip -in -selection primary'
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
# Automatically set window title
set -g automatic-rename on
set -g set-titles on
set -g set-clipboard on
set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 100000
zshfile=$('command -v zsh')
if-shell 'command -v zsh &> /dev/null' 'set -g default-command $zshfile'
set -g mode-keys vi
set -g monitor-activity on
set -g word-separators ' "`~!@#$%^&*_+-=()[]{};:\|/<>?,'
set -ag word-separators "'"
bind-key v split-window -h
bind-key s split-window -v
# Save pane content to file
bind-key ' ' capture-pane -JS -20000 \; save-buffer /tmp/tmux.history \; delete-buffer \; display-message "Saved /tmp/tmux.history"
bind-key P command-prompt -p 'lines:,filename:' -I '-40000,/tmp/tmux.history' 'capture-pane -JS %1; save-buffer %2; delete-buffer'
bind-key S command-prompt -p 'lines:,filename:' -I '-100000,/tmp/tmux.history' 'capture-pane -JS %1; save-buffer %2; delete-buffer'
bind-key ? list-keys
# Use Alt-arrow keys without prefix key to switch panes
bind-key -n M-Left resize-pane -L
bind-key -n M-Right resize-pane -R
bind-key -n M-Up resize-pane -U
bind-key -n M-Down resize-pane -D
# bind-key -n C-q send-keys C-]
# bind-key -n C-w send-keys quit ENTER
# bind-key -n C-w send-keys C-u reset ENTER aaa
bind-key -n C-t last-window
# bind-key -n C-Tab last-pane
# cycle through panes
bind-key -n C-Tab select-pane -t :.+
bind-key -n C-z select-pane -t :.-
# Use Alt-vim keys without prefix key to switch panes
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
bind-key -n M-h select-pane -L
bind-key -n M-j select-pane -D
bind-key -n M-k select-pane -U
bind-key -n M-l select-pane -R
# switch windows alt+number
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
bind-key -n M-4 select-window -t 4
bind-key -n M-5 select-window -t 5
bind-key -n M-6 select-window -t 6
bind-key -n M-7 select-window -t 7
bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9
# No delay for escape key press
set -sg escape-time 0
# Reload tmux config
bind-key r source-file ~/.tmux.conf \; display-message "Done reload ~/.tmux.conf"
# THEME
set -g status-justify centre
set -g status-bg black
set -g status-fg white
# set -g window-status-current-bg green
# set -g window-status-current-fg black
# set -g window-status-current-attr bold
set -g window-status-current-style fg=black,bg=green,bold
set -g status-interval 60
set -g status-left-length 30
set -g status-left '#[fg=green](#S) #h#[default]'
set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white](%F %R)#[default]'
# Mouse support
# https://unix.stackexchange.com/questions/318281/how-to-copy-and-paste-with-a-mouse-with-tmux
set -g mouse on
bind-key -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind-key -n WheelDownPane select-pane -t= \; send-keys -M
bind-key -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
bind-key -T copy-mode-vi C-WheelUpPane send-keys -X halfpage-up
bind-key -T copy-mode-vi C-WheelDownPane send-keys -X halfpage-down
bind-key -T copy-mode-emacs C-WheelUpPane send-keys -X halfpage-up
bind-key -T copy-mode-emacs C-WheelDownPane send-keys -X halfpage-down
# To copy, left click and drag to highlight text in yellow,
# once you release left click yellow text will disappear and will automatically be available in clibboard
bind-key -T copy-mode-vi v send-keys -X begin-selection
# Update default binding of `Enter` to also use copy-pipe
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -selection c"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe "xclip -in -selection clipboard"
unbind-key -T copy-mode-vi Enter
bind-key -T copy-mode-vi DoubleClick1Pane \
select-pane \; \
send-keys -X select-word \; \
send-keys -X copy-pipe "xclip -in -selection clipboard"
bind-key -n DoubleClick1Pane \
select-pane \; \
copy-mode -M \; \
send-keys -X select-word \; \
send-keys -X copy-pipe "xclip -in -selection clipboard"
# # Shift arrow to switch windows
# bind-key -n S-Left previous-window
# bind-key -n S-Right next-window
# bind-key M-j resize-pane -D
# bind-key M-k resize-pane -U
# bind-key M-h resize-pane -L
# bind-key M-l resize-pane -R