File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -24,15 +24,15 @@ extend_key() {
24
24
if tmux_is_at_least 2.4; then
25
25
# We fetch the current behavior of the 'key' mapping in
26
26
# variable 'cmd'
27
- cmd=$( tmux list-keys -T copy-mode- $( tmux_copy_mode ) | $AWK_CMD ' $4 == "' $key ' "' | $AWK_CMD ' { $1=""; $2=""; $3=""; $4=""; sub(" ", " "); print }' )
27
+ cmd=$( tmux list-keys -T $( tmux_copy_mode_string ) | $AWK_CMD ' $4 == "' $key ' "' | $AWK_CMD ' { $1=""; $2=""; $3=""; $4=""; sub(" ", " "); print }' )
28
28
# If 'cmd' is already a copycat command, we do nothing
29
29
if echo " $cmd " | grep -q copycat; then
30
30
return
31
31
fi
32
32
# We save the previous mapping to a file in order to be able to recover
33
33
# the previous mapping when we unbind
34
- tmux list-keys -T copy-mode- $( tmux_copy_mode ) | $AWK_CMD ' $4 == "' $key ' "' >> /tmp/copycat_$( whoami) _recover_keys
35
- tmux bind-key -T copy-mode- $( tmux_copy_mode ) " $key " run-shell " tmux $cmd ; $script ; true"
34
+ tmux list-keys -T $( tmux_copy_mode_string ) | $AWK_CMD ' $4 == "' $key ' "' >> /tmp/copycat_$( whoami) _recover_keys
35
+ tmux bind-key -T $( tmux_copy_mode_string ) " $key " run-shell " tmux $cmd ; $script ; true"
36
36
else
37
37
tmux bind-key -n " $key " run-shell " tmux send-keys '$key '; $script ; true"
38
38
fi
Original file line number Diff line number Diff line change @@ -41,6 +41,14 @@ tmux_copy_mode() {
41
41
tmux show-option -gwv mode-keys
42
42
}
43
43
44
+ tmux_copy_mode_string () {
45
+ if [ $( tmux_copy_mode) == ' vi' ]; then
46
+ echo copy-mode-vi
47
+ else
48
+ echo copy-mode
49
+ fi
50
+ }
51
+
44
52
# === copycat mode specific helpers ===
45
53
46
54
set_copycat_mode () {
@@ -152,7 +160,7 @@ copycat_prev_key() {
152
160
copycat_quit_copy_mode_keys () {
153
161
if tmux_is_at_least 2.4; then
154
162
local commands_that_quit_copy_mode=" cancel"
155
- local copy_mode=" copy-mode- $( tmux_copy_mode ) "
163
+ local copy_mode=" $( tmux_copy_mode_string ) "
156
164
tmux list-keys -T " $copy_mode " |
157
165
\g rep " $commands_that_quit_copy_mode " |
158
166
$AWK_CMD ' { print $4 }' |
You can’t perform that action at this time.
0 commit comments