.tmux: “run '~/.tmux/plugins/tpm/tpm'” has no effect in .tmux.conf.local

Created on 27 Mar 2017  ·  23Comments  ·  Source: gpakosz/.tmux

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
#
# # Other examples:
# # set -g @plugin 'github_username/plugin_name'
# # set -g @plugin '[email protected]/user/plugin'
# # set -g @plugin '[email protected]/user/plugin'
#
# # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

This was the code I added to .tmux.conf.local at the bottom. But it seems that tpm could't run as I expected.

When I added the code to .tmux.conf and reloaded the configuration,the error below was throwed:

'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' returned 127

But the strange thing was that I could use plugin of tmux normally this time. Spliting new pane would also throw the error.

How could I fix the error ? Any suggestion would be appreciated.

branch available enhancement waiting for feedback

Most helpful comment

Hi guys,

if you're using tmux.conf.local and you have problems making tpm work there's an alternate plugin definition syntax described here (second issue from the top): https://github.com/tmux-plugins/tpm/blob/master/docs/tpm_not_working.md

# List of plugins
 set -g @tpm_plugins '          \
   tmux-plugins/tpm             \
   tmux-plugins/tmux-sensible   \
   tmux-plugins/tmux-resurrect  \
 '

 # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
 run '~/.tmux/plugins/tpm/tpm'

This approach is guaranteed to work with any tmux source command combination. No need to add support for if '[ -f foo ]' 'source foo' to tpm.

All 23 comments

Hello @tripleCC, I'm not a TPM user myself.

'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' returned 127

This error usually means the tmux executable is not found in the path. You may want to see the output of

$ tmux run 'echo $PATH'

However, as far as I can tell, there's no straightforward way to make my configuration compatible with TPM:

  • I'm not familiar with TPM implementation
  • This would likely require changes on both sides
  • Using both kind-of defeats the purpose of having an easily transportable tmux configuration anyways

Have to do it on the .tmux.conf one. Before the line first instance of "# EOF" (This part is important).

@tripleCC
You need to use alternative plugin syntax if you want to have it in your .tmux.conf.local

See here: https://github.com/tmux-plugins/tpm/blob/master/docs/tpm_not_working.md

Hi @gpakosz 👋

I was facing this same problem too, but I managed to make it work through this change in tpm.

Also, I was about to open the PR but, in order to justify a good reason for that change, I started to search for documentation related to tmux.conf.local, and I found nothing official (except for this awesome repository 👍).

So now my question is, where does this (elegant) approach of .local files come from? I suspect is some kind of Linux users good practice, and if that's the case I would lovely open a PR to tpm based on that good practice.

Best regards!

Hello @well1791.

I don't plan myself to also take care of tpm. But would I open a PR, I would improve their _sourced_files() function to support these 3 possible situations:

  • source foo
  • source -q foo (tmux >= 2.3)
  • if '[ -f foo ]' 'source foo'

The third case is a bit more complicated because you would have to evaluate the condition before deciding the file will be sourced by tmux for real.

In the meantime, you can also decide to alter your .tmux.conf to replace

if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local'

by

source ~/.tmux.conf.local

And try to add set -g @plugin ... lines to your ~/.tmux.conf.local copy. Since I want to keep ~/.tmux.conf.local being optional, this is not a change I will merge though.

About a .local file, I don't believe it's an established pattern.

check this out https://github.com/tmux-plugins/tpm/issues/82. It helps with my problem!

Hi guys,

if you're using tmux.conf.local and you have problems making tpm work there's an alternate plugin definition syntax described here (second issue from the top): https://github.com/tmux-plugins/tpm/blob/master/docs/tpm_not_working.md

# List of plugins
 set -g @tpm_plugins '          \
   tmux-plugins/tpm             \
   tmux-plugins/tmux-sensible   \
   tmux-plugins/tmux-resurrect  \
 '

 # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
 run '~/.tmux/plugins/tpm/tpm'

This approach is guaranteed to work with any tmux source command combination. No need to add support for if '[ -f foo ]' 'source foo' to tpm.

216 should fix this

@bruno- bump

💁‍♂️ There is now a tpm branch up for testing that integrates Oh My Tmux! with TPM, see .tmux.conf.local for instructions

I've been using the mainline branch with tpm for a long time. However, it is in .tmux.conf not local.

Hello @vpassapera 👋

Please try the tpm branch and follow the instructions in the sample .tmux.conf.local file. There's no need to alter .tmux.conf file anymore.

@luisdavim @tripleCC @well1791 did you get a chance to test the tpm branch?

@gpakosz I did but just using the provided .tmux.conf.local and uncommenting a couple of plugin instructions given as example doesn't do it. <prefix> I doesn't seem to be bound. I am not sure how to install these plugins. Thoughts?

Otherwise, anything you'd like to be tested in particular?

Hey @behaghel 👋

Here's the way to test the tpm branch

  • make a backup of your current ~/.tmux.conf.local file and your ~/.tmux folder if needed
  • $ cd
  • $ rm -rf .tmux
  • $ git clone https://github.com/gpakosz/.tmux --branch tpm
  • $ ln -sf ~/.tmux/.tmux.conf
  • $ cp ~/.tmux/.tmux.conf.local .
  • then proceed with editing your ~/.tmux.conf.local copy and follow the instructions at the end to enable tpm and plugins
  • launch tmux

⚠️ Make sure you don't alter .tmux.conf. The sole fact of having set -g @plugin ... directives in your ~/.tmux.conf.local copy should trigger automatic tpm and plugins installation.

shouldn't the git line be github.com not github.conf

@pquodling thanks fixed the typo

I think I have followed the procedure faithfully but I am not getting much luck. The only thing that is changed is that ~/.tmux.conf.local doesn't load automatically anymore. Once I do load it manually (<prefix> : source ~/.tmux.conf.local) it seems to ignore set -g @plugin ... instructions. I tested with the _resurrect_ plugin and I couldn't tell it had been installed and loaded. E.g. nothing in keybindings (<prefix> ?). I am on a debian buster with tmux in version 2.8-3.

Hey @behaghel 👋

You're not supposed to source ~/.tmux.conf.local.

I confirmed it didn't work with tmux 2.8. Apparently in

source -q "~/.tmux.conf.local"

~ is not expanded while it is when I don't use double quotes.

I pushed a fix. Sorry for that!

Hey @gpakosz,

I pulled your fix and tried again …and it works! 👌

Thanks for your great work.

So?!

How is the testing going so far?

It just works. Have used that branch for the past 10 days and nothing to
report.

On Sat, 14 Nov 2020, 09:27 Gregory Pakosz, notifications@github.com wrote:

So?!

How is the testing going so far?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/gpakosz/.tmux/issues/61#issuecomment-727174023, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AAB5POAW4ZH5XXWNDCKVKLTSPZERRANCNFSM4DFG77OQ
.

Cool. "It just works" is indeed the goal

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shortspecialbus picture shortspecialbus  ·  3Comments

danielporto picture danielporto  ·  8Comments

fwarmuth picture fwarmuth  ·  5Comments

nikolayzhmurov picture nikolayzhmurov  ·  5Comments

eluft84 picture eluft84  ·  8Comments