tmux-plugins / tpm

Tmux Plugin Manager
MIT License
11.63k stars 412 forks source link

Enable non-default conf files #57

Open macarenomarco opened 8 years ago

macarenomarco commented 8 years ago

When using a file that isn't /etc/tmux.conf ~/.tmux.conf tpm doesn't load the plugin list. Not sure if it'd be better to include a separate .tmux/tpm.conf file which could include the location of the tmux config file.

bruno- commented 8 years ago

Hey, yea, this is a known issue. If tmux server is started with -f flag (tmux -f /some/path/to/conf.file) it will not load the new plugin syntax. I'm not sure this can be fixed.

There are 2 solutions for this:

1: you can use legacy plugin list definition in /some/path/to/conf.file, example:

set -g @tpm_plugins '\
  tmux-plugins/tmux-foo \
  tmux-plugins/tmux-bar \
'

2: you might just source another config file from ~/.tmux.conf, example:

source /some/path/to/conf.file

Quick question: why do you even use a different config file?

macarenomarco commented 8 years ago

Hey, sorry for taking so long and for not checking if this had been previously reported, my bad. About the different config file, I use multiple OS's and would like to keep my configurations for tmux separate, however I imagine it might not be the most popular case, but that's why the second solution wouldn't always work. It'd be awesome if tmux could return the location of it's config file but I haven't found anything of sorts, but I understand that having a single config file is way cooler and easier to use. What about an optional \@plugin-conf option? Or am I completely misunderstanding how the "@" functionality works?

bruno- commented 8 years ago

It'd be awesome if tmux could return the location of it's config file but I haven't found anything of sorts

Yea, I also couldn't find anything for this. I think tmux maintainers could add a flag for this if we ask them. Wanna give it a try on tmux-users group?

What about an optional \@plugin-conf option?

Can you elaborate this a bit? With this option: set -g @plugin-conf '/some/path/to/conf.file' tpm would read plugins from the additional file. But I think this is similar to just having source /some/path/to/conf.file.

Also, as mentioned above, the older syntax using @tpm_plugins is still supported. Did you try that one?

macarenomarco commented 8 years ago

No, I haven't. I figured out that if it's a depecrated syntax there must be a good reason for it. But yeah you're right, I completely forgot about the fact that in order to load those values it's necessary to read the main conf file which is the issue.

I think I'll try with the tmux-users group and if that work update you on the situation.

bruno- commented 8 years ago

Hey, the reason for deprecating @tpm_plugins is that the new syntax looks better and is easier to work with. Other than that things work the same. If tmux core team won't provide a patch for this we'll un-deprecate @tpm_plugins, continue supporting it and just call it "old syntax".

bruno- commented 8 years ago

I see tmux creator just responded positively to your request on tmux-users list.

@macarenomarco would you please forward that last message from the mailing list to my email? I'd like to respond to that thread, but it seems I need to have the email. I'm unable to respond via the web interface. Thanks

charlesbjohnson commented 8 years ago

This is also an issue for me (though I'm okay if I continue to use the old syntax).

I use a main tmux.conf that hooks up to a host specific tmux.conf.local and a plugin centric tmux.conf.plugins. Both of those files are are being sourced but tpm is unable to pick up on their contents (presumably because the sourcing happens conditionally at runtime?).

I support the un-deprecation of @tpm_plugins.

bruno- commented 8 years ago

Hi guys, the @tpm_plugins is un-deprecated with 620f06c524cc6ea2761c7cbc4640ac0a3fc3e7b4.

The issue with tmux custom config file using -f option is now documented here. The solution using @tpm_plugins is suggested.

HaleTom commented 5 years ago

FYI, anyone trying to follow the XDG Base Directory specification will run into this issue.

Arch users are directed to:

$ tmux -f "$XDG_CONFIG_HOME"/tmux/tmux.conf
$ export TMUX_TMPDIR="$XDG_RUNTIME_DIR"

https://wiki.archlinux.org/index.php/XDG_Base_Directory

augustobmoura commented 4 years ago

I think #77 might solve the problem, it's possible in new versions of tmux now

sgleizes commented 4 years ago

1: you can use legacy plugin list definition in /some/path/to/conf.file, example:

set -g @tpm_plugins '\
  tmux-plugins/tmux-foo \
  tmux-plugins/tmux-bar \
'

This solution only partially fixes the issue, as the list is still not updated by the function reload_tmux_environment which is called on install/update/clean. This means that editing the list of plugins at runtime and hitting e.g. <prefix>I will not install the new plugin(s), the tmux server has to be restarted entirely for it to work.

The problematic code is the aforementioned function in scripts/helpers/tmux_utils.sh. IMHO one way to cleanly address this problem would be the @plugin-conf previously suggested, or an environment variable similar to TMUX_PLUGIN_MANAGER_PATH, e.g. TMUX_CONFIG.

In the mean time, using @tpm_plugins and patching the function locally does the job: sed -i "s,~/.tmux.conf,$TMUX_CONFIG," scripts/helpers/tmux_utils.sh.

ioogithub commented 2 years ago

I have been struggling with this issue for over an hour. I am using byobu. No matter what I do I cannot get tmp to download the plugins.

I have changed the syntax in my .tmux.conf file to use the depreciated @tpm_plugins syntax as recommended here: https://github.com/tmux-plugins/tpm/blob/master/docs/tpm_not_working.md

I then do a $ tmux source /path/to/my_tmux.conf and start byobu and press: prefix + I.

I see a message:

TMUX environment reloaded.
Done, press ENTER to continue.

When I check my plugins folder, nothing has been downloaded. According to the tpm_not_working page "The plugins should now be working."

I also tried following @sgleizes advice and running the above sed command however it didn't patch any files. Should I be able to press prefix + I and tpm will download the plugins at this point or is tpm fundamentally incompatible with byobu?

pdecat commented 2 years ago

Is tpm fundamentally incompatible with byobu?

I use TPM with byobu (so with a config file at ~/.byobu/.tmux.conf), and can confirm shortcuts to manage plugins like prefix + I do not work.

As a work-around, I run:

~/.byobu/tmux_plugins/tpm/bin/update_plugins all