-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
148 lines (109 loc) · 5.17 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
#####################
###### Plugins ######
#####################
# Commands:
# Prefix+I - install plugins
# Prefix+alt+u - uninstall unlisted (ie, commented out) plugins
# Prefix+U - update plugins
set -g @plugin 'tmux-plugins/tpm'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'github_username/plugin_name#branch'
# set -g @plugin '[email protected]:user/plugin'
# set -g @plugin '[email protected]:user/plugin'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-yank'
#####################
###### Options ######
#####################
set -g default-terminal "screen-256color"
# Source: https://stackoverflow.com/questions/60309665/neovim-colorscheme-does-not-look-right-when-using-nvim-inside-tmux
set -ga terminal-overrides ",xterm-256color:Tc"
# For using other terminals
# set -ga terminal-overrides ",xterm-kitty:RGB"
# set -g terminal-overrides ",alacritty:RGB"
# Renumbers windows whenever one closes. For example, if we have windows 1,2,3,4 and we close 3,
# we want to renumber the windows to 1,2,3 instead of leaving it as 1,2,4
set -g renumber-windows on
set -g automatic-rename off
# Enable mouse support
set -g mouse on
# Prevent delay with escape press when in Neovim
set -g escape-time 0
# Have first windows and panes start with 1
set -g base-index 1
setw -g pane-base-index 1
# Undercurl: https://github.com/folke/lsp-colors.nvim#making-undercurls-work-properly-in-tmux
set -g default-terminal "${TERM}"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
##########################
###### Key Bindings ######
##########################
# Note that `bind` is just `bind-key`. The corresponding man page entry:
# Bind key key to command. Keys are bound in a key table. By default (without -T), the key is bound in the prefix key table. This table is used for keys
# pressed after the prefix key (for example, by default ‘c’ is bound to new-window in the prefix table, so ‘C-b c’ creates a new window). The root table is
# used for keys pressed without the prefix key: binding ‘c’ to new-window in the root table (not recommended) means a plain ‘c’ will create a new window. -n
# is an alias for -T root. Keys may also be bound in custom key tables and the switch-client -T command used to switch to them from a key binding. The -r
# flag indicates this key may repeat, see the repeat-time option. -N attaches a note to the key (shown with list-keys -N).
#
# To view the default bindings and possible commands, see the list-keys command.
# Rebind prefix from Ctrl-b to Ctrl-space
unbind C-space
set -g prefix C-space
bind C-space send-prefix
# Reload configuration with Prefix+r
# Note that the semi-colon is used to sequentially combine multiple tmux commands
bind r source-file ~/.tmux.conf \; display-message "Tmux config reloaded!"
# Prefix+% and Prefix+" is used to split the window horizontally and vertically, respectively.
# Bind to more intuitive keys
# -c is start-directory, so we split to the current directory.
# -f is for full window height/width
bind "\\" split-window -fhc "#{pane_current_path}"
bind | split-window -fhc "#{pane_current_path}"
bind - split-window -vc "#{pane_current_path}"
bind "_" split-window -fvc "#{pane_current_path}"
# Swap window to the left and right
bind -r "<" swap-window -d -t -1
bind -r ">" swap-window -d -t +1
# Create new window with the current pane's directory, and right next to the current one.
bind c new-window -a -c "#{pane_current_path}"
# Quickly toggle between the current and previous windows
bind Space last-window
# Quickly toggle between the current and previous sessions
bind C-Space switch-client -l
# Easy pane resizing keybinds
bind -r C-j resize-pane -D 15
bind -r C-k resize-pane -U 15
bind -r C-h resize-pane -L 15
bind -r C-l resize-pane -R 15
# Switch panes using Alt-arrow without prefix
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
bind -r "}" swap-pane -D # To the right (numerically greater)
bind -r "{" swap-pane -U # To the left (numerically smaller)
# This overrides a vim keymap
# bind -n M-h select-pane -L
# bind -n M-l select-pane -R
# bind -n M-k select-pane -U
# bind -n M-j select-pane -D
# Breaking out a pane into its own window: Prefix+!
bind j choose-window 'join-pane -h -s "%%"'
bind J choose-window 'join-pane -s "%%"'
# Use vi-style navigation in selection mode.
# Prefix-[ and navigate around like in vim, with tmux-yank we can
# easily copy to the system clipboard. Press C-v to toggle select
# block mode (just like vim).
set-window-option -g mode-keys vi
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel
############################
###### DESIGN CHANGES ######
############################
run-shell ~/.tmux/config/colorscheme.tmux
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'