-
Notifications
You must be signed in to change notification settings - Fork 60
Fix tmux-plugins/tmux-copycat#121 #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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`.
this seems to fix the issue on my system :-) |
Thank you for fixing this one. I just tried it on my system and it does the job. |
@bruno- Essentially, you need an interpreter for Changing |
@gregorias, what I meant was: can we get If yes, would that help with proper evaluation.. meaning |
@bruno- We could get it into single quotes, I guess, but it would do nothing to alleviate the problem. If you find my explanation in the first post unclear on why the change of quotes won't help, then You can also try it out for yourself and think about what the following shell scripts would print:
|
Expansion issue is actually on the |
eval "tmux $key_cmd" |
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.
When tmux-copycat restores the config it reads each line of that
temporary file into
key_cmd
and runstmux $key_cmd
. Now, when theshell expands
$key_cmd
it expands"xclip
,-selection
,clipboard"
into separate words.
tmux $key_cmd
runs effectively as: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
.