-
Notifications
You must be signed in to change notification settings - Fork 435
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
TPM doesn't read tmux options correctly—switch from regex to querying option value #85
Comments
\o/ looks like this landed in tmux 2.3: From the changelog:
|
I'm running into this issue still about two and a half years later. Should I open an issue for moving away from the Currently I work around this by leaving the
but it seems crazy that this is still done by parsing the |
If tpm isn't even reading the I would prefer to list plugins in a file like |
With PR #163 You can just add the following to your custom config file: set -g @tpm_conf_default_location '/path/to/tmux.conf.local' |
@spencerbutler I'm not sure how #163 actually solves this issue. The issue here is that tpm is not actually checking the value of What @cspotcode wants is not the ability to move the |
Having them in a single text file is less flexible. With the ability to set the option (and tmux actually querying the value of that option), we can do interesting things like loading plugins conditionally. If we have that, you could still opt to set your plugins in a separate sourceable tmux file, specifying one plugin per line (appending one plugin to the option per line). It gives everyone what they want. |
I don't actually need or want to have the options in a separate file; I was just rhetorically pointing out that the current implementation -- hacky regex parsing of the config file instead of actually reading a value from the proper API -- is nonsense. |
Right. I suggest that we create a new option |
About the implementation detail, a separator is needed, because it’s simply string concatenation instead of a real array. What could be the separator? I guess colon ( Bash implementation could be arr=(${str//,/ }) (Note that this doesn’t work for Zsh.) |
In Zsh you can do that like this:
This is documented in https://zsh.sourceforge.io/Doc/Release/Expansion.html#Parameter-Expansion-Flags (search for "field splitting"). |
Hey everyone, I found that the set-option -g @tpm_plugins '' # to be idempotent
set-option -ag @tpm_plugins 'tmux-plugins/tpm '
set-option -ag @tpm_plugins 'tmux-plugins/tmux-resurrect ' Caveat: only space is supported as the delimiter; comma is not. I’m good with it, though. If people do care about it, we can add a string replacement I mentioned above: tpm/scripts/helpers/plugin_functions.sh Line 73 in fc412cb
Update: it isn’t too much work, so I went ahead and created #238. |
I use set-option -g @tpm_plugins '';
set-option -g -a @tpm_plugins "tmux-plugins/tpm \n";
set-option -g -a @tpm_plugins "tmux-plugins/tmux-resurrect \n"; this works with current version TPM. |
TL;DR: Help me convince tmux to support appendable user options (like other string options), then you can inspect e.g.
@plugins
user option and we can do cool stuff like include plugins depending on some condition like tmux version or OS type or whatever.I tried to have a bit in my
.tmux.conf
file that reads like this:But this doesn't work. Weird. It works for other options.
After reading through the TPM code, I determined that TPM is trying to get the list of plugins by reading
.tmux.conf
instead of asking tmux what @plugin option values have actually been set.if-shell
returnstrue
.if-shell
returnstrue
but doesn't load plugin because although the@plugin
option is successfully set, TPM doesn't query tmux for the@plugin
option value, instead using a regex to try and determine what plugins to load.I know
if-shell
returns true becauseecho "$(tmux start-server\; show-option -gqv "@plugin")"
printsNHDaly/tmux-scroll-copy-mode
to the console, even though that plugin is not loaded.Wait a sec… I'd expect there to be more than one plugin listed (I've defined more before this conditional assignment).
Some digging has revealed that this is presumably because user options cannot be appended to, i.e you can't construct a string to explode into an array of values later, unlike other, builtin, string options.
I've opened an issue in tmux about this: tmux/tmux#533. If we get appendable user options you could perhaps create a new option
@plugins
to explode into an array and loop through. That way we can have one.tmux.conf
file for many different systems where different plugins are desired to be loaded.The text was updated successfully, but these errors were encountered: