.tmux: Plugins in status bar disappear on load or reload

Created on 30 Sep 2020  ยท  10Comments  ยท  Source: gpakosz/.tmux

My .conf
My .conf.local
Tmux version: 3.1b

I am using a CPU chart and ram plugin. On a new tmux session (or just a reload [prefix + r]), the plugin is loaded. You can see the text show up. But then immediately it disappears.

The workaround I have found is to set the source file to ~/.tmux.conf.local
This goes against everything in the documentation, but for some reason this allows the plugin to stay loaded.

I am fine with editing your .tmux.conf to source the .tmux.conf.local file on prefix + r, so that I can get this to work. But this is hopefully not an intentional thing.

Please let me know what is causing this. Thanks

duplicate enhancement

Most helpful comment

@gpakosz Thank you for supporting this feature (works well) and the great tmux config.

All 10 comments

I have this issue as well.
I have not modified tmux.conf.
I've added two plugins to my tmux.conf.local that have variables in the status bar.
robhurring/tmux-spotify
xamut/tmux-weather

When I reload tmux.conf, variables assigned in tmux.conf.local briefly appear in my status bar,
and then disappear after the message saying that my tmux.conf was reloaded.

when I directly source tmux.conf.local or add

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

BELOW

run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-time 3000 ; display "This configuration will soon require tmux >= 2.4" ; set -u display-time || true'

The variables are filled in my status bar.

Hello @ZachTheDev ๐Ÿ‘‹

The master branch of Oh My Tmux! doesn't support TPM.

However there is now a tpm branch up for testing, see .tmux.conf.local for instructions

Hello @ZachTheDev ๐Ÿ‘‹

The master branch of Oh My Tmux! doesn't support TPM.

However there is now a tpm branch up for testing, see .tmux.conf.local for instructions

Awesome! I'll give it a shot

i've switched over to the TPM branch, but I'm not quite sure how to use it.

In my .tmux.conf.local I have the following:

set -g @tpm_plugins '           \
    tmux-plugins/tpm             \
    tmux-plugins/tmux-sensible   \
    tmux-plugins/tmux-resurrect  \
    tmux-plugins/tmux-continuum  \
    robhurring/tmux-spotify      \
    xamut/tmux-weather          \
    tmux-plugins/tmux-cpu       \
'



set -g @continuum-restore 'on'
set -g @continuum-boot 'on'

tmux_conf_theme_status_left=' โ #S | โ†‘#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} '

tmux_conf_theme_status_right='| #{battery_percentage} | CPU: #{cpu_icon} #{cpu_percentage} | โ™ซ #{music_status} #{artist}: #{track} | %a %h-%d %H:%M '

run '~/.tmux/plugins/tpm/tpm'

I get the same behaviour when doing prefix+r to reload .tmux.conf. The variables briefly appear in my status bar and then dissapear when it says "tmux.conf sourced". When I do prefix+U, I see my list of plugins are recognized.

If I remove the "run '~/.tmux/plugins/tpm/tpm'`" from the bottom of .tmux.conf.local, the plugins are never initialized and doing prefix+U and prefix+I do nothing.

My plugins are where TPM should be, in ~/.tmux/plugins.

I chose robhurring/tmux-spotify + xamut/tmux-weather + tmux-plugins + tmux-cpu because I wanted to see if I could get any to stick in the status bar. I tried 1 at a time, and then throwing the whole kitchen sink into the right status.

If I'm using this branch incorrectly, let me know.
Thanks!

Hey @vacuumboots ๐Ÿ‘‹

Please start over with the tpm branch. Follow instructions in the sample .tmux.conf.local file

I imaged a macbook with a fresh install and made a new user.

  • installed brew.
  • installed tmux.
  • git cloned your repository, and switched to the tpm branch.
    I linked the tmux.conf and copied the tmux.conf.local to my home directory.

I removed the comments out of the plugins section, and added a variable in the right status bar for tmux-net-speed and tmux-cpu.

Now when I prefix+r, the cpu variables show up (the variables for net-speed do not, but that's probably to do with that project and my machine, and nothing to do with your project). when adding 'xamut/tmux-weather' anywhere in the right status with #{weather}, the variables of location and temperature show up as expected.

I did confirm that after modifying tmux.conf.local by adding or removing plugins, that prefix+r reloads the tmux.conf and also runs TPM and downloads and installs any new additions. Thats really slick. It's a small performance punishment to run that on each startup, but one that seems well worth it to me.

Thanks for introducing TPM support, it's a real nice feature.

might be worth mentioning somewhere NOT to add
run '~/.tmux/plugins/tpm/tpm' to tmux.conf.local, since you take care of it in tmux.conf.
Thanks again

I imaged a macbook with a fresh install and made a new user

Wow I had in mind a fresh ~/.tmux.conf.local copy and an unmodified .tmux.conf ๐Ÿ˜…
Thanks for going the extra mile!

the variables for net-speed do not, but that's probably to do with that project and my machine, and nothing to do with your project

Yep that project doesn't support macOS. I guess I'll remove it from the sample .tmux.conf.local file.

It's a small performance punishment to run that on each startup, but one that seems well worth it to me.

Well it shouldn't really delay startup as cloning happens in the background.

might be worth mentioning somewhere NOT to add run '~/.tmux/plugins/tpm/tpm'

That and also not consider tpm itself is a plugin as I made the choice to always upgrade tpm upon startup

Thanks for introducing TPM support, it's a real nice feature

Crossing fingers I won't have too many TPM support questions as I don't use it myself ๐Ÿคž

@gpakosz Thank you for supporting this feature (works well) and the great tmux config.

Closing as duplicated of #61

Was this page helpful?
0 / 5 - 0 ratings

Related issues

luisdavim picture luisdavim  ยท  6Comments

magostinelli picture magostinelli  ยท  6Comments

romanhaa picture romanhaa  ยท  4Comments

shortspecialbus picture shortspecialbus  ยท  3Comments

AtomicCoding picture AtomicCoding  ยท  3Comments