tmux-plugins / tpm

Tmux Plugin Manager
MIT License
11.97k stars 419 forks source link

Flexible TMux Configuration Load #143

Closed weilbith closed 5 years ago

weilbith commented 5 years ago

The current implementation is hard-coded about where to get the TMux configuration file for read in the listed plugins. But TMux could be started with a different configuration file. Following the XDG Directory Specification for TMux as also suggested in the ArchWiki, the default location does not fit anymore. In that case the plugin manager is unusable. To provide a more configurable solution, I've added a new function to search for the TMux configuration in prioritized order.

The implementation is super simple, but allows user like me to be more flexible.

bruno- commented 5 years ago

I glanced at the PR and it looks good. I have 2 questions:

Thanks!

weilbith commented 5 years ago

Tabs/Spaces Sry for that. Have reconstruct them on the recent commit. Maybe it would be wise to set this Vim configuration as comment? :thinking:

Variable I thought it would be nice to make it as easy for the user as possible. First I just implemented the XDG compatibility. Then I recognized, that some applications still use dotted files within XDG_CONFIG_HOM like Zsh for example. So I thought users can stuck again by that (with dot or not). After all I thought it would be the easiest solution for all cases to provide this configurable option. But I've you don't like it, I can simply remove it.

bruno- commented 5 years ago

@weilbith yea, let's remove the TMUX_PLUGIN_MANAGER_CONFIG_LOCATION variable for now. Let's wait for users to request that feature before implementing it. And returning this functionality (if needed) should be easy.

weilbith commented 5 years ago

Okay, done.

Open questions:

  1. Where should I extend the documentation? For example the alternative installation place instructions are not in the default README.
  2. Am I allowed to add a Vim configuration comment at the bottom to force the using of tabs? Cause I guess I will not be the only one doing this without purpose.
bruno- commented 5 years ago

@weilbith thanks!

Where should I extend the documentation?

I just added a short note via 42bb2bf48bef881be504278cf5156371b542cf81. If you have a better idea feel free to open another PR. If the docs are more than a paragraph I'd prefer if it's placed in docs/ dir so it doesn't clutter the README.

Am I allowed to add a Vim configuration comment

I'm a heavy vim user, but I prefer not doing this in any of my public projects. I feel this discriminates all other editors, by indicating preference to vim. Contributors usually figure out the spacing. Having set list in vim could be useful for this. Also, I kinda regret using tabs for all the plugins. I had "a reason" why I went with it, but now I think the convenience of two-space indentation would be better.

gnumoksha commented 5 years ago

Hi. This improvement came at the right moment for me, but I'm struggling to make this work. Is expected that ~/.tmux/plugins continue being created?

weilbith commented 5 years ago

@gnumoksha u can do so manually by following this documentation. This is not done automatically by where-your-tmux-config-is.

gnumoksha commented 5 years ago

@weilbith this made the job, thanks!

One thing I would like to add is that someone can expect TMUX_PLUGIN_MANAGER_PATH to be changed according to $XDG_CONFIG_HOME.

weilbith commented 5 years ago

@gnumosksha How do you expect that this works? If TPM finds the tmux.conf inside $XDG_CONFIG_HOME directory, it should set $TMUX_PLUGIN_MANAGER_PATH to the same location automatically?

dsifford commented 5 years ago

Does this PR resolve the issue involving nonstandard tmux paths? (#57)

Can those of us who use tmux by calling it with tmux -f "$XDG_CONFIG_HOME"/tmux/tmux.conf, now use the newer set -g @plugin [...] syntax without issue?

Edit: Just tried and the answer is, yes we can.