Skip to content

Commit 5f6bfc0

Browse files
committed
Fix #121
The issue was caused by incorrect parameter expansion. Copycat saves the old bindings inside /tmp/copycat_$(whoami)_recover_keys as they were provided on the command line, e.g. $ cat /tmp/copycat_$(whoami)_recover_keys | grep clipboard bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -selection clipboard" When tmux-copycat restores the config it reads each line of that temporary file into `key_cmd` and runs `tmux $key_cmd`. Now, when the shell expands `$key_cmd` it expands `"xclip`, `-selection`, `clipboard"` into separate words. `tmux $key_cmd` runs effectively as: tmux bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "\"xclip" -selection "clipboard\"" Which is not what we want. In order to fix this bug, this commit makes sure that a proper shell expansion happens by using `sh -c`.
1 parent 6f9b9cd commit 5f6bfc0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/copycat_mode_quit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ unbind_prev_next_bindings() {
1919

2020
unbind_all_bindings() {
2121
grep -v copycat </tmp/copycat_$(whoami)_recover_keys | while read key_cmd; do
22-
tmux $key_cmd
22+
sh -c "tmux $key_cmd"
2323
done < /dev/stdin
2424
rm /tmp/copycat_$(whoami)_recover_keys
2525
}

0 commit comments

Comments
 (0)