-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_tmux.conf
183 lines (132 loc) · 5.79 KB
/
dot_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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# Remap prefix to ctrl-a for screen consistency.
set -g prefix C-a
unbind C-b
bind-key C-a send-prefix
# Shell management.
# Set the default shell, and set the default command to use our shell (this
# means we source things properly, show the correct PS1 etc).
set -g default-shell ${SHELL}
set -g default-command ${SHELL}
# Mouse management.
# Enable mouse mode (tmux 2.1 and above)
set -g mouse on
# Colour management (yikes) and alert management.
# Use 256 colours.
set-option -ga terminal-overrides ",xterm-256color:Tc"
set-option -g default-terminal "screen-256color"
# Enable visual alerts for windows. Hide bells/silence.
set-window-option -g monitor-activity off # highlight active windows?
set-option -g visual-activity off # show a message on window activity?
set-option -g visual-silence off
set-option -g visual-bell off
set-option -g bell-action none
# Nested session configuration.
# Use ^b b to send the leader to a nested session. This means if you are
# using tmux and then ssh into a tmux session (i.e. a nested session) you
# can run commands in the nested session with ^B b <command>.
bind-key b send-prefix
# Keyboard Management.
# Don't wait for an escape sequence after hitting
# Esc. fixes insert mode exit lag in vim.
set -sg escape-time 0
# Clipboard / Copy / Paste
# Note: This is heavily OS dependent, which is why we have separate versions
# for OSX, Ubuntu etc. I'm trying out tmux-yank for this but it is still work in
# progress.
set-option -g set-clipboard on
bind P paste-buffer
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' begin/end selection as in Vim.
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
# Pane and Window Management.
# Open new panes and splits in the same working directory.
bind c new-window -c "#{pane_current_path}"
# Set the name of the window initially, but then don't let tmux change it.
# The name can still be set at any time with Ctrl+a + ,
set-option -g allow-rename off
# Start windows and panes at 1.
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
# When we add/remove windows, renumber them in sequential order.
set -g renumber-windows on
# Split panes using | and -
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Ctrl+B h/l to swap windows left/right, i.e. moving the tabs around.
bind-key h swap-window -t -1\; select-window -t -1
bind-key l swap-window -t +1\; select-window -t +1
# Vim style pane selection
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Meta + h/l to cycle through tabs.
bind-key -n M-h previous-window
bind-key -n M-l next-window
# Enable focus events, which are needed to keep vim's focus events working when
# vim is running inside tmux.
set -g focus-events on
## Status bar design
# set -g status-utf8 on
set -g status-justify left
set -g status-bg default
set -g status-interval 2
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank' # Cross-platform support for clipboard.
set -g @plugin 'aserowy/tmux.nvim'
set -g @plugin 'tmux-plugins/tmux-resurrect' # persist tmux sessions after computer restart
set -g @plugin 'tmux-plugins/tmux-continuum' # automatically saves sessions for you every 15 minutes
# continuum-restore configuration
## Restore Vim sessions
set -g @resurrect-strategy-vim 'session'
## Restore Neovim sessions
set -g @resurrect-strategy-nvim 'session'
## Restore Panes
set -g @resurrect-capture-pane-contents 'on'
## Restore last saved environment (automatically)
set -g @continuum-restore 'on'
set -g @continuum-boot 'on'
# Catppuccin theme
set -g @plugin 'catppuccin/tmux'
set -g @catppuccin_flavour 'mocha'
set -g @catppuccin_window_right_separator "█ "
set -g @catppuccin_window_number_position "right"
set -g @catppuccin_window_middle_separator " | "
set -g @catppuccin_window_default_fill "none"
set -g @catppuccin_window_current_fill "all"
set -g @catppuccin_status_modules "application session user host date_time"
set -g @catppuccin_status_left_separator "█"
set -g @catppuccin_status_right_separator "█"
set -g @catppuccin_date_time_text "%Y-%m-%d %H:%M:%S"
# navigation
set -g @tmux-nvim-navigation true
set -g @tmux-nvim-navigation-cycle true
set -g @tmux-nvim-navigation-keybinding-left 'C-h'
set -g @tmux-nvim-navigation-keybinding-down 'C-j'
set -g @tmux-nvim-navigation-keybinding-up 'C-k'
set -g @tmux-nvim-navigation-keybinding-right 'C-l'
# resize
set -g @tmux-nvim-resize true
set -g @tmux-nvim-resize-step-x 2
set -g @tmux-nvim-resize-step-y 2
set -g @tmux-nvim-resize-keybinding-left 'C-M-h'
set -g @tmux-nvim-resize-keybinding-down 'C-M-j'
set -g @tmux-nvim-resize-keybinding-up 'C-M-k'
set -g @tmux-nvim-resize-keybinding-right 'C-M-l'
# todo manager
bind -r D neww -c "#{pane_current_path}" "[[ -e TODO.md ]] && nvim TODO.md || nvim ~/TODO.md"
# clear screen
bind -n C-d clear-history
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'