Closed jandamm closed 4 years ago
+1 having same issue
I originally reported this to TPM because it was returning 1
on load, but after digging through source and running bash -x
a few times, I was able to narrow it down. The underlying issue is in scripts/helpers.sh
, line 38, inside the stored_engine_vars
function:
stored_engine_vars() {
tmux show-options -g | grep -i "^@open" | cut -d '-' -f2 | cut -d ' ' -f1 | xargs
}
As suggested by @jandamm in the original issue, the best solution would probably be to add something like grep -vi "^@open-editor"
in that pipeline. For that matter, running this manually (tmux show-options -g | command grep -i "^@open" | cut -d '-' -f2 | cut -d ' ' -f1
) and comparing to the output without the cut
s shows that my @open
setting of C-f
is also included in the output, which it probably shouldn't be. Maybe changing the grep pattern to ^@open-
would also be useful? A quick test of tmux show-options -g | command grep -i "^@open-" | command grep -vi "^@open-editor" | cut -d '-' -f2 | cut -d ' ' -f1
excludes my grep
aliases and produces the expected output of just S
.
For anyone else still experiencing this issue, you can manually edit your local copy; TPM doesn't update plugins from the source repos until you specifically tell it to. The "is installed" check just looks for the directory, so even installing new plugins shouldn't be an issue as long as you don't trigger an update of existing ones. A quick test by changing line 38 in my own install has it working properly, even after manually running tpm/scripts/install_plugins.sh
and using the prefix + I
keybind to do so automatically.
Open ~/.tmux/plugins/tmux-open/scripts/helpers.sh
(replace ~/.tmux/plugins
with your install location) and replace line 38 with the following:
tmux show-options -g | grep -i "^@open-" | grep -vi "^@open-editor" | cut -d '-' -f2 | cut -d ' ' -f1 | xargs
Thank you for narrowing this problem down. Fixed via a9d2971e4eeb1f664b60c398b785a9580bee0f9d
I dug into this and it turns out, that configuring the editor command is the issue:
It fully works as expected but tmux-open tries to add this as a search binding as well (like this example
set -g @open-S 'https://www.duckduckgo.com/'
) So the exit code of 1 is because tmux-open tries to bind the keyeditor
to the urlC-x
.This is the code where the error is produced. https://github.com/tmux-plugins/tmux-open/blob/cedb4584908bd8458fadc8d3e64101d3cbb48d46/open.tmux#L122
Probably the best solution would be to filter for
editor
as this has a special meaning and should not be added as a shortcut.