-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
195 lines (155 loc) · 8.04 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
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
184
185
186
187
188
189
190
191
192
193
194
195
# use C-a, since it's on the home row and easier to hit than C-b
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
set -g base-index 1
# Easy config reload
#bind-key r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
bind-key R source-file ~/.tmux.conf
# vi is good
setw -g mode-keys vi
# Everything commented out and indented was supposedly working fine, trying a fix listed here:
# https://github.com/rakr/vim-one
# # Appending this since tmux likes to break neovim colors. The second line is what solved the issue
# # Changing these two lines to use 24bit colors instead of the 256.
# ####### [ THESE SETTINGS WERE ACTIVE AND WORKING ] #########
# # set -g default-terminal "screen-256color"
# # set -ga terminal-overrides ",*256color*:Tc"
# # Setting truecolor support setting default terminal to xterm-24bit
# # Commented out while trying a fix for KiTTY.
# #set -g default-terminal "xterm-24bit"
# #set -ag terminal-overrides ',xterm-kitty:Tc'
# # Possible fix for SIXEL support within tmux.
# #set -ga terminal-overrides ',xterm*:smglr=\E7\E[?69h\E[%i%p1%d;%p2%ds\E8:mgc=\E7\E[?69l\E8'
# # Adding this 4-15-20 from a reddit thread saying it works for mintty true color support.
# #set -g default-terminal "tmux-256color"
# #set-option -ga terminal-overrides ",xterm*:Tc"
# Add truecolor support
#set-option -ga terminal-overrides ",xterm-256color:Tc"
# Default terminal is 256 colors
#set -g default-terminal "screen-256color"
# !!!importent!!! 开启24 bit color 其他方式都无效
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",*256col*:Tc"
# Enable terminal compatability.
# set-option -ga terminal-overrides ",tmux-256color-italic:Tc,xterm-256color-italic:Tc"
# mouse behavior
# (not working on NAS.
#
# setw -g mode-mouse on
# set -g mouse-select-pane on
# set -g mouse-resize-pane on
bind-key : command-prompt
bind-key r refresh-client
bind-key l clear-history
# Commenting this out for now based on this supposed solution for using <C-Tab>.
# https://github.com/mintty/mintty/wiki/Tips#switch-pane-in-tmux
#set -s user-keys[0] "\e[1;5I"
#set -s user-keys[1] "\e[1;6I"
#bind-key -n User0 next-window
#bind-key -n User1 previous-window
bind-key space next-window
bind-key bspace previous-window
bind-key enter next-layout
# use vim-like keys for splits and windows
bind-key C-h select-pane -L
bind-key C-j select-pane -D
bind-key C-k select-pane -U
# Manually re-assigning the move active-window right binding, since it broke C-L
# default TTY keybind for clearing the screen.
bind-key C-l select-pane -R
# Rebinding window split bindings to be more intuitive.
bind-key s split-window -h
bind-key v split-window -v
# These keybinds are for creating new tmux windows and vertical/horizontal pane splits that keep the
# same working directory as the pane/window the new pane/window is opened from.
bind-key C-c new-window -c "#{pane_current_path}"
bind-key C-v split-window -c "#{pane_current_path}"
bind-key C-s split-window -h -c "#{pane_current_path}"
# Binding <C-Tab> and <C-Shift-Tab> to cycling through windows. (Testing, may not be in installed version)
# Doesnt work on v3.0a however haven't fiddled with it much.
# bind-key -n C-Tab next-window
# bind-key -n C-S-Tab previous-window
# Binding <C-M-h> and <C-M-l> to cycle-window left/right.
# bind-key C-M-h previous-window
# Binding Control + vim-movement-keys to resizing windows.
bind-key -r C-y resize-pane -L
bind-key -r C-u resize-pane -D
bind-key -r C-i resize-pane -U
unbind-key C-o
bind-key -r C-o resize-pane -R
# Bindings for smart pane management to different windows.
# https://superuser.com/questions/600286/move-pane-to-a-new-window-in-tmux
## Join windows: <prefix> s, <prefix> j
bind-key J command-prompt -p "join pane from:" "join-pane -s '%%'"
bind-key S command-prompt -p "send pane to:" "join-pane -t '%%'"
# Honestly I have no idea what the below keybindings do, since I alrady have vim movement keybinds.
# Smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys 'C-\\') || tmux select-pane -l"
# Binds <C-A><C-L> to send the keybind <C-L> which is default for clear terminal.
# (Redundant since I have <M-L> bound to clear to avoid tmux quick vim-keybinds for movements.
# Commenting this out 08-11-2020 4PM so that <C-a>L Clears the tmux screen history (Doing this for when logged into the TTY console and using tmux since clearing shell-history does not blank out the screen).
#bind C-l send-keys 'C-l'
bind-key C-l clear-history
bind-key + select-layout main-horizontal
bind-key = select-layout main-vertical
set-window-option -g other-pane-height 25
set-window-option -g other-pane-width 80
bind-key M-p last-window
bind-key a last-pane
bind-key q display-panes
bind-key c new-window
bind-key t next-window
bind-key T previous-window
bind-key [ copy-mode
bind-key ] paste-buffer
# Vim keybind settings that idk what they do, but they're borken.
# Currently broken, possibly because of enabling testing branch of apt(?)
# Version 2.6 presented more errors than current version (3.0a)
# Setup 'v' to begin selection as in Vim
# bind-key -t vi-copy v begin-selection
#bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
#unbind -t vi-copy Enter
#bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
set-window-option -g display-panes-time 1500
# Status Bar
set-option -g status-interval 1
set-option -g status-left ''
set-option -g status-right '%l:%M%p'
set-option -g status-style 'fg=colour237'
#set -g status-left '#[bg=#f8f8f2]#[fg=#282a36]
# This option specifies statusbar color
set-window-option -g window-status-current-style 'fg=colour045,bg=colour237'
# Status Bar solarized-dark (default)
set-option -g status-style 'fg=colour033,bg=colour237'
set-option -g pane-active-border-style 'fg=colour033'
set-option -g pane-border-style 'fg=colour240'
# Status Bar solarized-light
if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g status-bg white"
if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g pane-active-border-fg white"
if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g pane-border-fg white"
# Set window notifications
setw -g monitor-activity on
set -g visual-activity on
# Enable native Mac OS X copy/paste
# [The command "which" is deprecated, so using built-in bash utility "command -v" instead]
#set-option -g default-command "/bin/bash -c 'which reattach-to-user-namespace >/dev/null && exec reattach-to-user-namespace $SHELL -l || exec $SHELL -l'"
set-option -g default-command "/bin/bash -c 'command -v reattach-to-user-namespace >/dev/null && exec reattach-to-user-namespace $SHELL -l || exec $SHELL -l'"
# Allow the arrow key to be used immediately after changing windows
set-option -g repeat-time 0
# Fixes the delay when leaving insert mode in vim while in a tmux session.
set -sg escape-time 0
# Testing various status settings.
# This changes the title of the terminal (aka, tmux doesn't force override the
# terminal title to "tmux attach-session" when in a tmux session).
# https://superuser.com/a/1098626
set-option -g set-titles on
set-option -g set-titles-string "#S / #W"
# Taking this bit from a github post of someones tmux.conf that pulls weather from wttr.in and puts it on the tmux status line.
# https://gist.github.com/spicycode/1229612?permalink_comment_id=2931335#gistcomment-2931335
#set -g status-left '#(curl "wttr.in/format=1") '