Open gerases opened 6 years ago
This, as you described it, works as designed. Honestly, this plugin was not written to handle your use case (multiple tmux server processes).
Should it not consider only the running user's processes?
Yes, I think this is a good suggestion. I'd be open to accepting a PR for this.
I also have problems with autosave not working even though I only have one tmux process
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-strategy-nvim 'session'
# Continuum
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'
# Ressurect vim sessions
set -g @resurrect-strategy-vim 'session'
set -g @resurrect-strategy-nvim 'session'
# Resurrect other programs
set -g @resurrect-processes '~server_osx.py'
# Change key bindings
set -g @resurrect-save 'S'
set -g @resurrect-restore 'R'
So I don't have multiple tmux servers running, but I am attached in multiple places:
$ ps -ef | grep tmux
501 15381 1 0 Sun10am ?? 9:03.52 tmux
501 22576 22450 0 11:41am ttys000 0:00.01 tmux a
501 24276 16899 0 11:43am ttys007 0:00.00 grep tmux
501 23241 23119 0 11:42am ttys020 0:00.01 tmux a
501 23508 23386 0 11:42am ttys021 0:00.01 tmux a
This causes issues with automated recordings. Manually saving them works fine, and occasionally the save works, but generally it's that the symlink isn't pointing where it should.
I also this problem. It seems that the default interval of 15 min isn't applied. If I manually set
set -g @continuum-save-interval '15'
it /seems/ to work.
I judge by the output of scripts/continuum_status.sh which I put into my powerline configuration.
Without the setting continuum_status.sh gives this:
./scripts/continuum_status.sh: line 12: [: -gt: unary operator expected
off
I had the same issue, contrary to what the README says without explicitly specifying the save interval in .tmux.conf, auto-saving doesn't work.
I had a problem with autosave though I'm using only one tmux server. I use tmux attach to attach the sessions. This gets counted in for all_tmux_processes. So, I added a grep -v for tmux attach in helpers.sh
all_tmux_processes() {
# ignores `tmux source-file .tmux.conf` command used to reload tmux.conf
ps -Ao "command pid" |
\grep "^tmux" |
\grep -v "^tmux source" |
\grep -v "^tmux attach"
}
It works now.
Not sure what exactly caused it but for me the culprit was https://github.com/jimeh/tmux-themepack. When sourcing my plugins with tpm I had to make sure to add the themepack before continuum.
Before (not working):
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugins 'tmux-plugins/tmux-continuum'
set -g @plugin 'jimeh/tmux-themepack'
After (working):
set -g @plugin 'jimeh/tmux-themepack'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugins 'tmux-plugins/tmux-continuum'
Maybe it helps someone else :)
:O Ill give it a go!
Would make sense as the auto save command gets written into status-right
.
So everything that sets status-right
would have to be loaded beforehand.
At least if I got right from reading the code. In my opinion this should be stated in the readme (if correct).
EDIT:
Just tested it by echoing from ./scripts/continuum_save.sh main().
The script is the first segment of the right status.
So every modification of status-right
has to be done before tpm sources continuum.
That's annoying. I manually override status right so that it only shows the information that I want to show :|. I have to run these overrides after run '~/.tmux/plugins/tpm/tpm'
otherwise they won't get applied
The added script doesn't print anything so there isn't anything added to your status-right visually. It just uses the refresh of the status line to run the save script.
If you have to modify status-right
after tpm and want to use auto save, try adding this to your status-right
:
#(~/.tmux/plugins/tmux-continuum/scripts/continuum_save.sh)
Holy crap you're right it is fixed for me now. Thank you so much for investigating this!
If you are using "Oh My Tmux" (https://github.com/gpakosz/.tmux):
Open .tmux.conf
and find the following line:
# status_right=$(echo "$status_right" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g')
Add these two lines after the above-mentioned line:
# continuum_auto_save='#(~/.tmux/plugins/tmux-continuum/scripts/continuum_save.sh)'
# status_right="$status_right$continuum_auto_save"
Save .tmux.conf
and reload tmux configuration by <prefix> r
inside a tmux session. Auto save should work now.
If you are using "Oh My Tmux" (https://github.com/gpakosz/.tmux):
Open
.tmux.conf
and find the following line:# status_right=$(echo "$status_right" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g')
Add these two lines after the above-mentioned line:
# continuum_auto_save='#(~/.tmux/plugins/tmux-continuum/scripts/continuum_save.sh)' # status_right="$status_right$continuum_auto_save"
Save
.tmux.conf
and reload tmux configuration by<prefix> r
inside a tmux session. Auto save should work now.
👍 👍 👍 Thank you so much for solving the oh-my-tmux issue! It works for me.
FYI, I added a minor pull request that makes continuum's dependency on status-right clearer in the README - https://github.com/tmux-plugins/tmux-continuum/pull/98.
I also created issue https://github.com/tmux-plugins/tmux-continuum/issues/99 to look for some hook other than status-right. I'm not sure if tmux has one, but would be nice if continuum didn't depend on status-right. I personally don't have the status bar on.
I have no problem with this. Why not just set -g status-right 'Continuum status: #{continuum_status}'
?
I am half giving up on this, would you @nyngwang post what it looks like the continuum status on tmux bar, please? I always have a tmux error with no server running after reboot.
Just in case sharing my working config. With this config there is autosave every 1m and fully working "Continuum status" that shows "1" at status-right.
set -g default-terminal "xterm-256color"
set -g default-command zsh
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @continuum-restore 'on'
set -g @continuum-save-interval '1'
set -g status-right 'Continuum status: #{continuum_status}'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
Maybe it can be useful to someone :)
Autosave is not working and I've narrowed it down to this piece of code:
The problem is that I share my work environment with several co-workers. So, in total we may have > 3 tmux processes. This function grabs all of them:
Long story short, it seems that
add_resurrect_save_interpolation
is never called becausecontinuum
thinks there are more than one TMUX servers running. Should it not consider only the running user's processes?