-
Notifications
You must be signed in to change notification settings - Fork 0
/
prefix-escape.conf
259 lines (227 loc) · 11.2 KB
/
prefix-escape.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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
display -p "[1884] prefix_key: #{prefix_key} [current policy]"
# Useless
# run -C '#{init}' # syntax error (comes from %if)
# Useless
# run -C "$init" # syntax error (comes from %if)
# source "$DOT_CONFIG/terminal/tmux/init.conf"
# unbind -T root "$escape_key" # $normal_key
# unbind -T prefix "$escape_key" # $normal_key
# # unbind -T root "$normal_key"
# unbind -T root "$assist_key"
# %hidden assist_on_root=""
# setenv -ghu assist_on_root
#
# %hidden bind_assist_on_root=""
# setenv -ghu bind_assist_on_root
#
# %hidden escape_on_root=""
# setenv -ghu escape_on_root
#
# %if "#{escape_on_root}"
# display -p "[1911] [error] escape_on_root already defined: #{escape_on_root}"
# confirm-before -p "escape_on_root already defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
# %else
# display -p "[1914] [succeeded] escape_on_root already cleared: #{escape_on_root}"
# %endif
#
# %hidden bind_escape_on_root=""
# setenv -ghu bind_escape_on_root
#
# setenv -ghu unbind_escape_on_root
#
# %if "#{escape_key}"
# %hidden unbind_escape_on_root="
# unbind -T root \"$escape_key\"
# "
# %else
# %hidden unbind_escape_on_root=""
# %endif
#
# %hidden escape_on_prefix=""
# setenv -ghu escape_on_prefix
#
# %hidden bind_escape_on_prefix=""
# setenv -ghu bind_escape_on_prefix
#
# %hidden assist_on_prefix=""
# setenv -ghu assist_on_prefix
#
# %hidden bind_assist_on_prefix=""
# setenv -ghu bind_assist_on_prefix
# %hidden unbind_assist_on_prefix=""
# setenv -ghu unbind_assist_on_prefix
#
# %hidden escape_on_normal=""
# setenv -ghu escape_on_normal
# %hidden assist_on_normal=""
# setenv -ghu assist_on_normal
#
# display -p "[1945] Composition factory initialized"
# display -p "[1946] prefix_key: #{prefix_key}"
# display -p "[1947] normal_key: #{normal_key}"
# display -p "[1948] escape_key: #{escape_key}"
# display -p "[1949] assist_key: #{assist_key}"
%if #{!=:#{prefix_enter},}
%if #{escape_on_root}
display -p "[1955] [error] escape_on_root already defined: #{escape_on_root}"
confirm-before -p "[1956] [error] normal_key: #{normal_key}, escape_on_root already defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
%else
display -p "[1958] [succeeded] escape_on_root already cleared: #{escape_on_root}"
%endif
# if-shell -F '#{escape_on_root}' {
%if #{escape_on_root}
display -p "[1809] [error] escape_on_root already defined: #{escape_on_root}"
confirm-before -p "prefix_key: #{prefix_key}, assist_key: #{assist_key}, escape_on_root already defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
%else
# } {
# %if "#{==:#{prefix_key},Escape}" # #AA0000
display -p "[1968] escape_on_root is gonna be assigned: #{escape_on_root}"
%hidden escape_on_root="$prefix_enter"
display -p "[1970] [succeeded] escape_on_root was assigned: #{escape_on_root}"
# %endif
# %if '#{escape_on_root}'
# # if-shell -F "#{escape_on_root}" {
# display -p "[1923] [error] escape_on_root already defined: #{escape_on_root}"
# confirm-before -p "normal_key: #{normal_key}, escape_on_root already defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
# # } {
# %else
# display -p "[1927] [succeeded] escape_on_root already cleared: #{escape_on_root}"
# %endif
# # }
%endif
# }
# %if '#{escape_on_root}'
# display -p "[1935] [error] escape_on_root already defined: #{escape_on_root}"
# confirm-before -p "normal_key: #{normal_key}, escape_on_root already defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
# %else
# display -p "[1938] [succeeded] escape_on_root already cleared: #{escape_on_root}"
# %endif
%if '#{bind_escape_on_root}'
display -p "[1816] [error] bind_escape_on_root already defined: #{bind_escape_on_root}"
confirm-before -p "prefix_key: #{prefix_key}, assist_key: #{assist_key}, bind_escape_on_root already defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
%else
%hidden bind_escape_on_root="
bind -T root "$escape_key" "$prefix_enter"
"
%endif
%if '#{escape_on_normal}'
display -p "[1825] [error] escape_on_normal already defined: #{escape_on_normal}"
confirm-before -p "prefix_key: #{prefix_key}, escape_on_normal already defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
%else
%hidden escape_on_normal="$prefix_enter"
%endif
%else # "#{prefix_enter}"
display -p "\$prefix_enter not defined: $prefix_enter"
confirm-before -p "prefix_key: #{prefix_key}, \$prefix_enter not defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
%endif # "#{prefix_enter}"
%if #{!=:#{prefix_quit},}
%if '#{escape_on_prefix}'
display -p "[1839] [error] escape_on_prefix already defined: #{escape_on_prefix}"
confirm-before -p "prefix_key: #{prefix_key}, escape_on_prefix already defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
%else
%hidden escape_on_prefix="$prefix_quit"
display -p "[2019] escape_on_prefix <= prefix_quit"
# %if "#{==:#{prefix_quit},#{escape_on_prefix}}"
# display -p "prefix_quit == escape_on_prefix"
# %else
# display -p "prefix_quit != escape_on_prefix"
# %endif
%endif
%if '#{bind_escape_on_prefix}'
display -p "[1853] [error] bind_escape_on_prefix already defined: #{bind_escape_on_prefix}"
confirm-before -p "prefix_key: #{prefix_key}, bind_escape_on_prefix already defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
%else
%hidden bind_escape_on_prefix="
bind -T root "$escape_key" "$prefix_quit"
"
%endif
%else # "#{prefix_quit}"
display -p "\$prefix_quit not defined: $prefix_quit"
confirm-before -p "prefix_key: #{prefix_key}, \$prefix_quit not defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
%endif # "#{prefix_quit}"
%if "#{prefix_copy}"
%else
display -p "\$prefix_copy not defined: $prefix_copy"
confirm-before -p "prefix_key: #{prefix_key}, \$prefix_copy not defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
%endif # "#{prefix_copy}"
%if #{!=:#{assist_key},}
%if "#{normal_enter}"
%if '#{assist_on_prefix}'
display -p "[1876] [error] assist_on_prefix already defined: #{assist_on_prefix}"
confirm-before -p "prefix_key: #{prefix_key}, assist_key: #{assist_key}, assist_on_prefix already defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
%else
%hidden assist_on_prefix="$normal_enter"
%endif
%if '#{bind_assist_on_prefix}'
display -p "[1883] [error] bind_assist_on_prefix already defined: #{bind_assist_on_prefix}"
confirm-before -p "prefix_key: #{prefix_key}, assist_key: #{assist_key}, bind_assist_on_prefix already defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
%else
%hidden bind_assist_on_prefix="
# bind -T prefix '$normal_key' \"$normal_prefix\"
bind -T prefix '$assist_key' \"$normal_enter\"
"
%endif
%if '#{unbind_assist_on_prefix}'
display -p "[1893] [error] unbind_assist_on_prefix already defined: #{unbind_assist_on_prefix}"
confirm-before -p "prefix_key: #{prefix_key}, assist_key: #{assist_key}, unbind_assist_on_prefix already defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
%else
%hidden unbind_assist_on_prefix="
unbind -T prefix '$assist_key'
"
%endif
%if '#{assist_on_root}'
display -p "[1902] [error] assist_on_root already defined: #{assist_on_root}"
confirm-before -p "prefix_key: #{prefix_key}, assist_key: #{assist_key}, assist_on_root already defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
%else
%hidden assist_on_root_nvim="$normal_enter"
%hidden assist_on_root="
if-shell -F '#{@is-vim}' {
if-shell -F '#{@is-insert}' {
send-keys C-c # Escape
}
# send-keys SPACE N
send-keys M-N
} {
$normal_enter
}
"
unbind -n "$toggle_key"
# bind -n "$toggle_key" "$normal_enter"
bind -n "$toggle_key" "$assist_on_root"
# display -p "assist_on_root <= send-keys ESCAPE SPACE N"
%hidden bind_assist_on_root="
# bind -T root '$assist_key' \"$normal_enter\"
# bind -T root '$assist_key' send-keys ESCAPE SPACE N
bind -T root '$assist_key' \"$assist_on_root\"
"
%endif
%else
display -p "\$normal_enter not defined: $normal_enter"
confirm-before -p "prefix_key: #{prefix_key}, assist_key: #{assist_key}, \$normal_enter not defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
%endif
%if "#{normal_quit}"
%if '#{assist_on_normal}'
display -p "[1920] [error] assist_on_normal already defined: #{assist_on_normal}"
confirm-before -p "prefix_key: #{prefix_key}, assist_key: #{assist_key}, assist_on_normal already defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
%else
# %hidden assist_on_normal_impl="$normal_quit"
%hidden assist_on_normal="$normal_quit"
# %hidden assist_on_normal="send-keys ESCAPE SETQUIT"
%endif
%else
display -p "\$normal_quit not defined: $normal_quit"
confirm-before -p "normal_key: #{normal_key}, \$normal_quit not defined. kill-session #{session_id} ? (y/n)" kill-session # no current client
%endif # "#{normal_quit}"
%hidden unbind_assist_on_root="
unbind -T root '$assist_key'
"
%else # "#{assist_key}"
%hidden bind_assist_on_prefix=""
%hidden unbind_assist_on_prefix=""
%hidden bind_assist_on_root=""
%hidden unbind_assist_on_root=""
%hidden assist_on_root=""
%hidden assist_on_prefix=""
# %hidden escape_on_prefix=""
%endif # "#{assist_key}"
# }