tmux-plugins / tmux-resurrect

Persists tmux environment across system restarts.
MIT License
11.42k stars 424 forks source link

nvim doesn't restore when called with absolute path #329

Closed sidequestboy closed 4 years ago

sidequestboy commented 4 years ago

I had an alias in my .zshrc set up to call nvim like so:

export EDITOR='/usr/bin/nvim'
alias e="$EDITOR"

when I call nvim with this alias, it is not restored. If I change the alias to:

alias e="nvim"

it is restored correctly

The relevant resurrect lines in my .tmux.conf are:

## resurrect
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'
set -g @continuum-boot 'on'
set -g @continuum-save-interval '15'

# for vim
set -g @resurrect-strategy-vim 'session'
# for neovim
set -g @resurrect-strategy-nvim 'session'

This resurrect file fails in restoring nvim launched by /usr/bin/nvim .zshrc:

tmux_resurrect_20200215T191909.txt

This resurrect file fails in restoring nvim launched by nvim .zshrc:

tmux_resurrect_20200215T191937.txt

adding the line

set -g @resurrect-processes '/usr/bin/nvim'

in my .tmux.conf works around the issue and the latter file successfully restores the /usr/bin/nvim process.

I would have expected tmux-resurrect to restore in both cases.

chrischen commented 4 years ago

I think this issue is related to this: https://github.com/tmux-plugins/tmux-resurrect/issues/338

ppid command will show /usr/bin/nvim which is what is used for the save strategy (that's also causing a problem for non-forked processes).

chrischen commented 4 years ago

I think this issue is related to this: https://github.com/tmux-plugins/tmux-resurrect/issues/338

ppid command will show /usr/bin/nvim

bruno- commented 4 years ago

We restore nvim if the command == nvim. Since /usr/bin/nvim != nvim, the command with the full path is not restored.

As you discovered you can do set -g @resurrect-processes '/usr/bin/nvim' or set -g @resurrect-processes '"~nvim"'. Those restores will not be "smart". Eg restoring with neovim's session might not work as smooth.

bruno- commented 4 years ago

As for natively supporting full path commands like /usr/bin/nvim: you're the first guy to ask for that in 5 - 6 years, so no plans for doing that.