tmux-plugins / tmux-continuum

Continuous saving of tmux environment. Automatic restore when tmux is started. Automatic tmux start when computer is turned on.
MIT License
3.29k stars 149 forks source link

Autosave doesn't work, #{continuum_status} is empty #42

Open janbuchar opened 7 years ago

janbuchar commented 7 years ago

I installed continuum by cloning it and then adding run-shell ~/.tmux/plugins/tmux-continuum/continuum.tmux to my config file. Resurrect works fine, but continuum doesn't seem to be doing anything. Also, the #{continuum_status} variable is empty. Is there any other thing I have to do?

bruno- commented 7 years ago

Did you try reloading tmux config file?

janbuchar commented 7 years ago

Yes, in fact I waited for a couple of days and rebooted a handful of times.

bruno- commented 7 years ago

Can you please provide this info https://github.com/tmux-plugins/tmux-continuum/blob/master/CONTRIBUTING.md

janbuchar commented 7 years ago

.tmux.conf last session file

bruno- commented 7 years ago

Can you try moving run-shell from here at the bottom of your tmux.conf.

In general you want to run your plugin after the options are set. In this case @continuum-save-interval is set after the plugin is run.

janbuchar commented 7 years ago

Looks like autosave works, thanks! However, continuum_status is still empty.

mdeguzis commented 6 years ago

Variable is empty for me too

fejiso commented 6 years ago

Empty for me as well

rrebollo commented 6 years ago

Same problem for me here!!! Any ideas???

clayreimann commented 6 years ago

When I run the status command manually on my mac I see:

 ~ → ~/.tmux/plugins/tmux-continuum/scripts/continuum_status.sh
/Users/clayreimann/.tmux/plugins/tmux-continuum/scripts/continuum_status.sh: line 12: [: -gt: unary operator expected
off

I don't know if this line is borked because I'm using the default save interval (and so have never explicitly set the interval).

Edit: the error went away when I set @continuum-save-interval but that didn't fix the status bar.

rpdelaney commented 6 years ago

Edit: Please don't tag me. I can't help with this any more than I already have.


@clayreimann

Line 12 is: if [ $save_int -gt 0 ]; then

That error indicates that $save_int is unset when line 12 is reached.

It's set here, on line 9: local save_int="$(get_tmux_option "$auto_save_interval_option")"

That explains why the error went away when you set @continuum-save-interval. It seems that $auto_save_interval_option needs to be populated with the default value in this script.

I don't have this error and I'm not sure why not. But try changing line 9 to this: local save_int="$(get_tmux_option "${auto_save_interval_option:-15}")"

If that fixes it then a PR should be an easy fix.

bestvibes commented 5 years ago

Same issue for me as well! Has anyone found a solution yet? Setting @continuum-save-interval removes the error from the script but the status still shows up empty. I'm on Mac 10.14.5 and tmux 2.9a.

rpdelaney commented 5 years ago

@bestvibes Can you try the change I suggested in my comment above yours? I don't use this plugin anymore but if someone can confirm that it fixes the problem I will send a PR.

Edit: I'm not clear what you mean by this bit:

...the status still shows up empty.

Can you expand on that?

bestvibes commented 5 years ago

@rpdelaney I tried what you mentioned, and I had the same result as @clayreimann above your comment. The error went away when running the script and it just shows 15 now. However when I add the status to the status bar in tmux it still shows empty, even though the script returns 15. I hope that clarifies it! I can give more details tonight once I'm near my computer.

slowkow commented 5 years ago

My #{continuum_status} was off even though I had this line in my .tmux.conf:

set -g @continuum-restore 'on'

Then, I changed my .tmux.conf to include this line:

set -g @continuum-save-interval 15

Finally, I ran tmux source ~/.tmux.conf and the status changed to 15 instead of off.

Now it looks like it is working:

$ ls -T ~/.tmux/resurrect/
~/.tmux/resurrect
├── last -> tmux_resurrect_20191009T110430.txt
├── pane_contents.tar.gz
├── save
│  └── pane_contents
└── tmux_resurrect_20191009T110430.txt

I'm using tmux 2.9a on macOS.

xave commented 4 years ago

In addressing the empty status bar concern:

For manual installations of the tmux-continuum plugin, you need to make sure the run-shell command is after any set -g commands or the Continuum-status: will be blank, presumably because the script will have run before those optional settings have been provided to it otherwise.

In essence:

`set -g @foo`
`set -g @bar`
`run-shell /path/to/tmux/continuum/continuum.tmux` #must be the last line for continuum portion of tmux config
alex-popov-tech commented 4 years ago

Hi guys, same thing... here is my tmux conf - https://github.com/alex-popov-tech/.dotfiles/blob/master/configs/tmux.conf and i see empty continuum_status variable in status line, and automatic saving does NOT happens also :( but if i will run mayually continuum_save.sh or continuum_status.sh they both works as expected (save session or show current status text)

Any ideas on that?

cc @slowkow @rpdelaney

alex-popov-tech commented 4 years ago

@bruno- any updates on that topic?

rpdelaney commented 4 years ago

@alex-popov-tech The fix I described in my previous comment is still working for me. I'm not sure what else to suggest.

illuz commented 3 years ago

I put confg settings before @plugin and it works.

set -g @continuum-restore 'on'
set -g @continuum-save-interval '1'

set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'

Just try it. @slowkow @rpdelaney @alex-popov-tech

rpdelaney commented 3 years ago

I don't have this error and I'm not sure why not.

Please don't tag me... I can't help with this any more than I already have.

mdeguzis commented 3 years ago

Idk why it doesn't get sourced right, but this fixed it for me

# top of tmux.conf somewhere 
# For some reason, the var doesn't get set normally for #{continuum_status}
run-shell "tmux setenv -g continuum_status $(~/.tmux/plugins/tmux-continuum/scripts/continuum_status.sh)

if-shell '[ $(echo "$TMUX_VERSION >= 1.9" | bc -l) == 1 ]' \
    "\
    set -g @continuum-save-interval '5'; \
    set -g status-right 'Continuum status: #{continuum_status}'; \
    set -g @plugin tmux-plugins/tpm; \
    set -g @plugin tmux-plugins/tmux-logging; \
    set -g @plugin tmux-plugins/tmux-resurrect; \
    set -g @plugin tmux-plugins/tmux-continuum; \
    set -g @continuum-restore 'on' \
    "

And to someone's point above, yes, if you don't put the save/status first, you'll often get this instead:

$ tmux source ~/.tmux.conf
usage: set-option [-aFgosquw] [-t target-window] option [value]
danielkrajnik commented 3 years ago

I think it was set -g @continuum-save-interval '5'; that made it tick

luchaoqi commented 1 year ago

I think it was set -g @continuum-save-interval '5'; that made it tick

Same, need to specify the interval in the config file to start the plugin