-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtmux.conf
More file actions
151 lines (119 loc) · 5.7 KB
/
tmux.conf
File metadata and controls
151 lines (119 loc) · 5.7 KB
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
set-option -g default-terminal tmux-256color
# Rebind action key to `
unbind-key C-b
set-option -g prefix `
bind-key ` send-prefix
# allow switching between two prefixes
bind-key C-q set-option -g prefix C-g \; unbind-key ` \; bind-key C-g send-prefix
bind-key C-w set-option -g prefix ` \; unbind-key C-g \; bind-key ` send-prefix
# Confirm before killing
bind-key k confirm kill-window
bind-key K confirm kill-server
# Refresh the screen, sometimes just needed
bind-key R refresh-client
# Make the escape key not delay so vim is more responsive
set -sg escape-time 0
# Make tmux control the xterm window title based on title of current pane
set -g set-titles on
set-option -g allow-rename on
set-window-option -g xterm-keys on
set-window-option -g alternate-screen on
set-window-option -g wrap-search off
# Move windows around
unbind-key .
bind-key m command "swap-window -t '%%'"
# Easy movement
bind-key -n M-Left prev
bind-key -n M-Right next
# Have a good history
set-option -g history-limit 50000
# Make tmux emit focus events
set -g focus-events on
# I almost never want to stop at - or _ in words
set-option -g word-separators ' @'
# Start window indexing at 1
set-option -g base-index 1
set-window-option -g pane-base-index 1
# Pause so I can read the dang message
set-option -g display-time 2500
# Don't notify on window activity
set-window-option -g monitor-activity off
set-option -g visual-bell off
set-option -g visual-activity off
# Style the tabs
set-option -g message-style 'fg=blue,bg=black'
set-window-option -g mode-style 'fg=colour236,bold,bg=colour230'
set-option -g status-left ''
set-option -g status-style 'fg=black,bg=colour0'
set-option -g status-interval 1
# set-option -g status-right '%b %d #[fg=cyan]%I:%M #[default]%p'
set -g status-right '#(usage --rgb 1 --tmux --order fwcai)'
set-window-option -g window-status-format '#[fg=colour10,bg=colour0]#I:#W '
set-window-option -g window-status-current-format '#[fg=black,bg=colour10] #[fg=black,bold,bg=colour10]#I:#W #[fg=colour10,bg=black] '
set-window-option -g window-status-style 'fg=colour10,bg=terminal'
# The command mode box
set-option -g message-style 'bg=default,fg=colour248'
# Let me know which pane is active
set-option -g pane-active-border-style 'fg=yellow,bg=default'
set-option -g pane-border-style 'fg=black,bg=default'
# split windows like vim
# vim's definition of a horizontal/vertical split is reversed from tmux's
unbind-key '"'
bind-key s split-window -v -c "#{?pane_current_path,#{pane_current_path},$HOME}"
unbind-key %
bind-key v split-window -h -c "#{?pane_current_path,#{pane_current_path},$HOME}"
bind-key c neww -c "#{?pane_current_path,#{pane_current_path},$HOME}"
# Make copy commands operate more like vim
unbind-key -T copy-mode-vi ' '
# unbind-key -t copy-mode-vi Enter
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle\; send-keys -X begin-selection
bind-key -T copy-mode-vi Escape send-keys -X cancel
bind-key -T copy-mode-vi Space send-keys -X page-down
# move around panes with j and k, a bit like vim
bind-key h select-pane -L
bind-key l select-pane -R
bind-key j select-pane -D
bind-key k select-pane -U
# The above are fallbacks for when the next set don't fullfil you movment needs,
# e.g. tmux on a remove server and your local tmux window has multiple panes
# These is inlined here instead of an external script to keep latency low
bind-key -n C-h run "[[ $(tmux display-message -p '#{pane_current_command} #{window_panes}') =~ ^n?vim | 1$ ]] && tmux send-keys C-h || tmux select-pane -L"
bind-key -n C-j run "[[ $(tmux display-message -p '#{pane_current_command} #{window_panes}') =~ ^n?vim | 1$ ]] && tmux send-keys C-j || tmux select-pane -D"
bind-key -n C-k run "[[ $(tmux display-message -p '#{pane_current_command} #{window_panes}') =~ ^n?vim | 1$ ]] && tmux send-keys C-k || tmux select-pane -U"
bind-key -n C-l run "[[ $(tmux display-message -p '#{pane_current_command} #{window_panes}') =~ ^n?vim | 1$ ]] && tmux send-keys C-l || tmux select-pane -R"
# bind-key -n C-\ run "[[ $(tmux display-message -p '#{pane_current_command} #{window_panes}') =~ ^n?vim | 1$ ]] && tmux send-keys 'C-\\' || tmux select-pane -l"
# vi-style controls for copy mode
set-option -g status-keys vi
set-window-option -g mode-keys vi
# My default terminal has 180 columns so setup the max vertical window width
# to be half of that for ease of viewing and the max rows is 66 so half of that
set-window-option -g main-pane-width 90
set-window-option -g main-pane-height 33
set-window-option -g aggressive-resize on
# enable the mouse
set-option -g mouse on
# Only enter copy-mode if the pane is not in alternate mode, e.g. vim
bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
# Integrate direnv
set-option -g update-environment "DIRENV_DIFF DIRENV_DIR DIRENV_WATCHES"
set-environment -gu DIRENV_DIFF
set-environment -gu DIRENV_DIR
set-environment -gu DIRENV_WATCHES
set-environment -gu DIRENV_LAYOUT
new-session -d -s main 'exec sudo htop'
run-shell -b 'init-tmux'
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-sessionist'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-sidebar'
set -g @continuum-restore 'on'
set -g @resurrect-strategy-vim 'session'
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
set -g @sidebar-tree-command 'tree -C'
run '~/.tmux/plugins/tpm/tpm'